<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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.<br>
<br>
-Kai Meyer<br>
<br>
On 10/19/2011 09:47 PM, rohan puri wrote:
<blockquote
cite="mid:CALJfu6PJiD_+GH2-tvFV_JG2FPOYr9ZyWVc2O4jK4835+8dCZw@mail.gmail.com"
type="cite"><br>
<br>
<div class="gmail_quote">On Thu, Oct 20, 2011 at 2:25 AM, Kai
Meyer <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:kai@gnukai.com">kai@gnukai.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
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 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
moz-do-not-send="true" 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 moz-do-not-send="true"
href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a moz-do-not-send="true"
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>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Kernelnewbies mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a>
<a class="moz-txt-link-freetext" href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a>
</pre>
</blockquote>
</body>
</html>