From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stamatis Mitrofanis Date: Mon, 15 Oct 2001 00:15:37 +0000 Subject: Re: Device count (to be done with) Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Oliver Neukum wrote: >>The reason for all this fuss is that the hotplug scripts be able to >>properly _un_load modules as well as loading them. Just consider what >>happens when you have two USB HID mice and you unplug one of them. The >>driver gets unloaded while it shouldn't (the other mouse is still in). >> >>I just noted that a very simple way to do this is to add a new >>"should-count" in the module loading/unloading mechanism and extend >>modprobe a bit to support it. That ought to be a very simple change. >>Also, it is not really necessary for the kernel modules themselves to >>support playing with this count (but it would be a good thing though). >> >>I hope I'm not missing anything. Please give me more details. >> >There should be indeed a second counter. >However you would not want it in the module load and unload path. To make >sense it has to be incremented on device detection and decremented on device >removal. All you need now is to make it queryable from user space to let >modprobe check. >For USB you increment on successful probe() and decrement on disconnect() > Apparently, we have two very similar proposals... :-) If I got your idea right, you suggest that: - should-count is stored for each kernel module, independent of "subsystem" (usb, pci etc.). - when should-count is decremented to 0, the module is "autoclean". - should-count is queried by kernel. - should-count is incremented/decremented by kernel. - should-count is queried by modprobe. I was suggesting the following: - should-count is stored for each kernel module, independent of "subsystem". - when should-count is decremented to 0, the module is "autoclean". - should-count is queried by kernel. - should-count is incremented/decremented by kernel. - should-count is queried by modprobe. - should-count is incremented/decremented by modprobe. It's just whether user-space is allowed to increment/decrement the count that differs. I believe that there has to be a user-space interface to this count since the should-count is abstract (hence not specific to PCI, USB or anything) and counts just "reasons for this module to remain loaded (not to be autocleaned)" . Thus, user-space may have its own set of reasons to have this module loaded in the kernel. I think we've pretty much settled this issue. So now, the question is (again), who's going to write it... _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel