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