I\'m creating a character device. I found two way to initialize char device
cdev_alloc
and
cdev_init
Acc
According to linux device drivers 3rd edition .
cdev_alloc() is a older mechanism .this is used for getting cdev structure at runtime of your character driver module .then you have to manually assign operation to ops variable to cdev structure .However cdev_init is the new mechanism in this we have to pass cdev structure variable (or already initialized cdev structure pointer) and file operation variable,for information go here
http://lwn.net/Kernel/LDD3/
chapter 3