device still in memory after removing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
}


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux