Re: Trouble removing character device

2011-10-20 Thread Kai Meyer
I do call unregister_chrdev_region. There are 5 functions in my original 
email that I call during the life of my module. Still no luck.


-Kai Meyer

On 10/19/2011 09:47 PM, rohan puri wrote:



On Thu, Oct 20, 2011 at 2:25 AM, Kai Meyer > wrote:


Unfortunately I can't share the source code, it belongs to the
company I
work for.

All of cdev_init, cdev_del, and unregister_chrdev_region are void
functions, so they have no return value.

I check the return value of alloc_chrdev_region and cdev_add and check
for errors with BUG_ON (for now).

-Kai Meyer

On 10/19/2011 02:18 PM, Daniel Baluta wrote:
> On Wed, Oct 19, 2011 at 7:04 PM, Kai Meyermailto:k...@gnukai.com>>  wrote:
>> I can't seem to get my character device to remove itself from the
>> /proc/devices list. I'm calling all of the following functions
like so:
>>
>> alloc_chrdev_region(&dev, 0, 5, "my_char");
>> cdev_init(&my_cdev,&my_ops);
>> cdev_add(&my_cdev, MKDEV(my_major, my_minor), 1);
>> cdev_del(&my_cdev);
>> unregister_chrdev_region(my_major, 5);
>>
>> It seems like I'm missing something, but I can't find it. I'm
>> referencing the Linux Device Drivers v3, chapter 3. In the
example code,
>> the scull_cleanup_module function calls cdev_dell and
>> unregister_chrdev_region, just like I do.
>>
>> To be clear, after I unload my module (after calling cdev_del and
>> unregister_chrdev_region), my "my_char" string still shows up in
>> /proc/devices.
> Did you check  return codes for all functions?
> Also, can you post a link to the code?
>
> thanks,
> Daniel.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org

> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org

http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


During cleanup i think you need to call function 
unregister_chrdev_region().


Regards,
Rohan Puri


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Trouble removing character device

2011-10-19 Thread rohan puri
On Thu, Oct 20, 2011 at 2:25 AM, Kai Meyer  wrote:

> Unfortunately I can't share the source code, it belongs to the company I
> work for.
>
> All of cdev_init, cdev_del, and unregister_chrdev_region are void
> functions, so they have no return value.
>
> I check the return value of alloc_chrdev_region and cdev_add and check
> for errors with BUG_ON (for now).
>
> -Kai Meyer
>
> On 10/19/2011 02:18 PM, Daniel Baluta wrote:
> > On Wed, Oct 19, 2011 at 7:04 PM, Kai Meyer  wrote:
> >> I can't seem to get my character device to remove itself from the
> >> /proc/devices list. I'm calling all of the following functions like so:
> >>
> >> alloc_chrdev_region(&dev, 0, 5, "my_char");
> >> cdev_init(&my_cdev,&my_ops);
> >> cdev_add(&my_cdev, MKDEV(my_major, my_minor), 1);
> >> cdev_del(&my_cdev);
> >> unregister_chrdev_region(my_major, 5);
> >>
> >> It seems like I'm missing something, but I can't find it. I'm
> >> referencing the Linux Device Drivers v3, chapter 3. In the example code,
> >> the scull_cleanup_module function calls cdev_dell and
> >> unregister_chrdev_region, just like I do.
> >>
> >> To be clear, after I unload my module (after calling cdev_del and
> >> unregister_chrdev_region), my "my_char" string still shows up in
> >> /proc/devices.
> > Did you check  return codes for all functions?
> > Also, can you post a link to the code?
> >
> > thanks,
> > Daniel.
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

During cleanup i think you need to call function unregister_chrdev_region().

Regards,
Rohan Puri
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Trouble removing character device

2011-10-19 Thread Kai Meyer
Unfortunately I can't share the source code, it belongs to the company I 
work for.

All of cdev_init, cdev_del, and unregister_chrdev_region are void 
functions, so they have no return value.

I check the return value of alloc_chrdev_region and cdev_add and check 
for errors with BUG_ON (for now).

-Kai Meyer

On 10/19/2011 02:18 PM, Daniel Baluta wrote:
> On Wed, Oct 19, 2011 at 7:04 PM, Kai Meyer  wrote:
>> I can't seem to get my character device to remove itself from the
>> /proc/devices list. I'm calling all of the following functions like so:
>>
>> alloc_chrdev_region(&dev, 0, 5, "my_char");
>> cdev_init(&my_cdev,&my_ops);
>> cdev_add(&my_cdev, MKDEV(my_major, my_minor), 1);
>> cdev_del(&my_cdev);
>> unregister_chrdev_region(my_major, 5);
>>
>> It seems like I'm missing something, but I can't find it. I'm
>> referencing the Linux Device Drivers v3, chapter 3. In the example code,
>> the scull_cleanup_module function calls cdev_dell and
>> unregister_chrdev_region, just like I do.
>>
>> To be clear, after I unload my module (after calling cdev_del and
>> unregister_chrdev_region), my "my_char" string still shows up in
>> /proc/devices.
> Did you check  return codes for all functions?
> Also, can you post a link to the code?
>
> thanks,
> Daniel.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Trouble removing character device

2011-10-19 Thread Daniel Baluta
On Wed, Oct 19, 2011 at 7:04 PM, Kai Meyer  wrote:
> I can't seem to get my character device to remove itself from the
> /proc/devices list. I'm calling all of the following functions like so:
>
> alloc_chrdev_region(&dev, 0, 5, "my_char");
> cdev_init(&my_cdev, &my_ops);
> cdev_add(&my_cdev, MKDEV(my_major, my_minor), 1);
> cdev_del(&my_cdev);
> unregister_chrdev_region(my_major, 5);
>
> It seems like I'm missing something, but I can't find it. I'm
> referencing the Linux Device Drivers v3, chapter 3. In the example code,
> the scull_cleanup_module function calls cdev_dell and
> unregister_chrdev_region, just like I do.
>
> To be clear, after I unload my module (after calling cdev_del and
> unregister_chrdev_region), my "my_char" string still shows up in
> /proc/devices.

Did you check  return codes for all functions?
Also, can you post a link to the code?

thanks,
Daniel.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Trouble removing character device

2011-10-19 Thread Kai Meyer
I can't seem to get my character device to remove itself from the 
/proc/devices list. I'm calling all of the following functions like so:

alloc_chrdev_region(&dev, 0, 5, "my_char");
cdev_init(&my_cdev, &my_ops);
cdev_add(&my_cdev, MKDEV(my_major, my_minor), 1);
cdev_del(&my_cdev);
unregister_chrdev_region(my_major, 5);

It seems like I'm missing something, but I can't find it. I'm 
referencing the Linux Device Drivers v3, chapter 3. In the example code, 
the scull_cleanup_module function calls cdev_dell and 
unregister_chrdev_region, just like I do.

To be clear, after I unload my module (after calling cdev_del and 
unregister_chrdev_region), my "my_char" string still shows up in 
/proc/devices.

-Kai Meyer

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies