<br><br><div class="gmail_quote">On Thu, Oct 20, 2011 at 2:25 AM, Kai Meyer <span dir="ltr"><<a href="mailto:kai@gnukai.com">kai@gnukai.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Unfortunately I can't share the source code, it belongs to the company I<br>
work for.<br>
<br>
All of cdev_init, cdev_del, and unregister_chrdev_region are void<br>
functions, so they have no return value.<br>
<br>
I check the return value of alloc_chrdev_region and cdev_add and check<br>
for errors with BUG_ON (for now).<br>
<font color="#888888"><br>
-Kai Meyer<br>
</font><div><div></div><div class="h5"><br>
On 10/19/2011 02:18 PM, Daniel Baluta wrote:<br>
> On Wed, Oct 19, 2011 at 7:04 PM, Kai Meyer<<a href="mailto:kai@gnukai.com">kai@gnukai.com</a>> wrote:<br>
>> I can't seem to get my character device to remove itself from the<br>
>> /proc/devices list. I'm calling all of the following functions like so:<br>
>><br>
>> alloc_chrdev_region(&dev, 0, 5, "my_char");<br>
>> cdev_init(&my_cdev,&my_ops);<br>
>> cdev_add(&my_cdev, MKDEV(my_major, my_minor), 1);<br>
>> cdev_del(&my_cdev);<br>
>> unregister_chrdev_region(my_major, 5);<br>
>><br>
>> It seems like I'm missing something, but I can't find it. I'm<br>
>> referencing the Linux Device Drivers v3, chapter 3. In the example code,<br>
>> the scull_cleanup_module function calls cdev_dell and<br>
>> unregister_chrdev_region, just like I do.<br>
>><br>
>> To be clear, after I unload my module (after calling cdev_del and<br>
>> unregister_chrdev_region), my "my_char" string still shows up in<br>
>> /proc/devices.<br>
> Did you check return codes for all functions?<br>
> Also, can you post a link to the code?<br>
><br>
> thanks,<br>
> Daniel.<br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br>During cleanup i think you need to call function unregister_chrdev_region().<br><br>Regards,<br>Rohan Puri<br>