what is difference between cdev_alloc and cdev_init

后端 未结 3 1023
渐次进展
渐次进展 2021-01-13 06:24

I\'m creating a character device. I found two way to initialize char device

cdev_alloc

and

cdev_init

Acc

3条回答
  •  时光说笑
    2021-01-13 06:44

    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

提交回复
热议问题