Re: PATCH: (as177) Add class_device_unregister_wait() andplatform_device_unregister_wait() to the driver model core

From: Alan Stern
Date: Sun Jan 25 2004 - 12:33:48 EST


On Fri, 23 Jan 2004, Linus Torvalds wrote:

> HOWEVER - I do worry when people start exporting interfaces that are
> basically _designed_ to deadlock. It's a bad interface. Don't export it.
> There is possibly just _one_ place that can do it, and it's the module
> unload part. Everything else would be a bug.

You know, this problem and other similar ones related to module unloading
would go away if modules behaved more like other kernel objects:

if they could be unregistered (rmmod) at any time, regardless
of their refcount;

if they would persist in an unregistered state, until they were
released (unloaded from memory) when the refcount dropped to 0.

Then it wouldn't be necessary for a module's exit routine to wait when
unregistering devices. A device could simply hold a reference to the
module; when the device was released and things were safe the module would
be unloaded. The one exception would no longer exist.

Is there some reason why modules don't work like this?

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/