On Thu, Apr 06, 2000 at 04:38:50PM +0200, Alessandro Rubini wrote:

> Nope. All normal modules are unremovable when the device is in use.
> So, either you implement a feedback from the mousedev and keybdev
> modules towards the usbmouse and usbkeyb drivers, so they know when
> their data is being used, or you consider the fact that the device is
> plugges as a symptom that is is being used.

Think hotplug PCI. That'll soon appear in the kernel. Would you want an
user to remove the PCI card to be able to remove the module as well?

I could easily add MOD_INC_COUNT to a dev->open callback in usbmouse.c.
That's no problem. However, this would also mean I'll never be able to
remove usbkbd.o or hid.o, because a keyboard is always in use with the
console system.

I really don't want to have to crawl under the table to unplug the USB
keyboard or reboot the machine in case I want to unload the USB drivers.
With the changes you propose, I'd have to.

Should the host controller drivers only be possible to unload when no
USB devices are connected to them as well?

What I'm trying to say is that you're intentionally killing an useful
feature (being able to remove / insert drivers anytime) just because
some software automatically unloads all modules it can unload.

That's why I'd like to see a separate 'is used' and 'is possible to
unload' flags. So that it is possible to manually remove a driver and so
that an automated tool doesn't remove it.

By the way, I've never fully understood why people want their drivers
auto-unloaded. When the hardware is there, the driver should take care
of it and have all its resources allocated so that other drivers while
probing don't step on its toes.

> While it's true that having a PCI frame grabber doesn't mean it is in
> use, you can't remove the device while the computer is on, and there
> is a clean way to know if someone is grabbing. With USB things are the
> other way round: you can unplug the device and you can't easily know
> whether someon is reading your data.

You can tell when someone is reading your data even on USB and even with
the input architecture. However, because the USB architecture already
forced the drivers not to count on having the device plugged in, the
drivers are the same - also hotplug - possible to remove and insert
anytime. It'd be a loss to forbid that.

> The more I think of it, the more I'm convinced that having a zero
> usage count while the device is in use is a real bug. I definitely
> don't want my keyboard driver to be removed while i'm typing.

Then don't let your cron job remove it. It's wrong to assume that if a
module can be unloaded that it isn't necessary. What about modules that
aren't used at the moment, but can't be autoloaded?

> > Johannes Erfeldt is working on something like that.
> 
> Then you agree that "device plugged" means "device in use". Every
> other module is autoloaded at open time, but you agree that USB
> drivers ought to be loaded at plug time.

Yes, I do. But I don't agree to the "device in use" -> "driver must not
be possible to unload" part.

-- 
Vojtech Pavlik
SuSE Labs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to