On Wed, Apr 05, 2000 at 11:18:55PM +0200, Alessandro Rubini wrote:
> Hello. Once again, please Cc: me as I'm not in this list.
>
> Still studying the drivers/usb directory using modules, I found that
> the usage count of mousedev.o and keybdev.o never raises above 0.
>
> If I got the point of the input mechanism, the usage count should be
> increased whenever the "connect" handler gets called, and decresead at
> "disconnect" time. Donald's description of usage counts matches my
> point, so this time I propose a patch. This is completely untested, but
> it "obviously right", with my usual bug rate of 1bug/line.
>
> Note that this is different from my previous point, as earlier I was
> referring to usbmouse.c and usbkbd.c.
>
> This fix is not sponsored by Suse :)
Well, I don't know whether this is good or bad. Yes, this makes the
module stay in the kernel as long as there are any mice or keyboards
connected.
I don't know if this is desirable.
I myself, while developing, depend quite a lot on inserting/removing
these modules most of the time without having to unplug the mice.
But perhaps users won't need that and it'd be easier for them not to
have to change their cron job.
I designed the modules to increase the module count only in case they
can't be unloaded without causing problems. This comes nicely along with
the hotplug architecture of the USB, where you can remove anything
anytime.
> --- ./mousedev.c.orig Wed Apr 5 23:10:30 2000
> +++ ./mousedev.c Wed Apr 5 23:11:27 2000
> @@ -419,6 +419,7 @@
> }
> #endif
>
> + MOD_INC_USE_COUNT;
> return 0;
> }
>
> @@ -437,6 +438,7 @@
> kfree(mousedev);
> }
> #endif
> + MOD_DEC_USE_COUNT;
> }
>
> static struct input_handler mousedev_handler = {
> --- ./keybdev.c.orig Wed Apr 5 23:11:50 2000
> +++ ./keybdev.c Wed Apr 5 23:12:24 2000
> @@ -149,6 +149,7 @@
>
> printk("keybdev.c: Adding keyboard: input%d\n", dev->number);
>
> + MOD_INC_USE_COUNT;
> return 0;
> }
>
> @@ -159,6 +160,7 @@
> input_close_device(handle);
>
> kfree(handle);
> + MOD_DEC_USE_COUNT;
> }
>
> static struct input_handler keybdev_handler = {
--
Vojtech Pavlik
SuSE Labs
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]