Hi,
I use char device with dynamic allocation of major number, when loading the driver to memory I get the major number 250, when removing the driver and reloading the same driver I get a new number: 249... (and so on)
when I look at /proc/devices I see the my driver with the 250 and 249.
My question is am I not removing the driver properly?
code:
int init_module(void) {
retval = alloc_chrdev_region(&devt, 0, 1, DEVICE_NAME);
pdata->cdev.owner = THIS_MODULE;
cdev_init(&pdata->cdev, &fops);
retval = cdev_add(&pdata->cdev, devt, 1);
}
void cleanup_module(void) {
cdev_del(&pdata->cdev);
unregister_chrdev_region(MAJOR(devt), 1);
}