Re: device still in memory after removing

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

 



Hi,

On Fri, Nov 6, 2009 at 7:35 AM, Mena Soliko <solikoman@xxxxxxxxx> wrote:
> 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);

You should call it like that: ([1])
unregister_chrdev_region(devt, 1);

> }
>

thanks,
Daniel.

[1]http://lxr.linux.no/#linux+v2.6.31/fs/char_dev.c#L306

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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