From: kai@gnukai.com (Kai Meyer)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Trouble removing character device
Date: Thu, 20 Oct 2011 09:41:41 -0600 [thread overview]
Message-ID: <4EA04135.6070804@gnukai.com> (raw)
In-Reply-To: <CALJfu6PJiD_+GH2-tvFV_JG2FPOYr9ZyWVc2O4jK4835+8dCZw@mail.gmail.com>
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 <kai@gnukai.com
> <mailto:kai@gnukai.com>> 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<kai@gnukai.com
> <mailto:kai@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 at kernelnewbies.org
> <mailto:Kernelnewbies@kernelnewbies.org>
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> <mailto: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 at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111020/6df5dea6/attachment.html
prev parent reply other threads:[~2011-10-20 15:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-17 20:04 How can I test if a physical address is already mapped or not StephanT
2011-10-18 5:52 ` Rajat Sharma
2011-10-18 17:23 ` StephanT
2011-10-18 20:47 ` Jeff Haran
2011-10-18 20:58 ` StephanT
2011-10-18 21:16 ` Jeff Haran
2011-10-19 0:28 ` StephanT
2011-10-19 0:46 ` Jeff Haran
2011-10-19 1:01 ` StephanT
2011-10-19 1:16 ` Jeff Haran
2011-10-19 5:48 ` Rajat Sharma
2011-10-19 17:10 ` StephanT
2011-10-19 16:04 ` Trouble removing character device Kai Meyer
2011-10-19 20:18 ` Daniel Baluta
2011-10-19 20:55 ` Kai Meyer
2011-10-19 21:34 ` Understanding memcpy Kai Meyer
2011-10-20 4:00 ` rohan puri
2011-10-20 15:40 ` Kai Meyer
2011-10-20 3:47 ` Trouble removing character device rohan puri
2011-10-20 15:41 ` Kai Meyer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EA04135.6070804@gnukai.com \
--to=kai@gnukai.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.