On Fri, 27 Dec 2013 19:33:50 -0800, Eric Fowler said: > I suspect I am doing something wrong in the code with > register/unregister_chrdev(), but I have been over that code a million > times. It looks fine. > > Now: > insmod the device, OK > rmmod the device, OK > Check /proc/devices , device # is present > insmod the device again, fails with ERROR: could not insert module > ./foobar.ko: Device or resource busy It does smell like an unregister issue. You may want to try adding printk() calls to print out the return code from register and unregister. I'm willing to bet that (a) the unegister is failing because somebody still has a reference on the device, and (b) the second register call fails because the device already exists, causing your module_init() to bail out. The fun is that you may not have taken a reference on the device directly yourself - you may have called some other get_foo() that ends up taking an implicit reference under the covers, causing issues when you fail to call put_foo() at the right place...
Attachment:
pgppNkq02hCpB.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies