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

From: Rusty Russell
Date: Tue Jan 27 2004 - 01:58:30 EST


On Sun, 25 Jan 2004 20:21:37 +0000
viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:

> Basically, "protect the module" is wrong - it should be "protect specific
> object" and we need that anyway.

Agreed. You're oversimplifying a little, though.

In this model, the object here is the function text. So if you hand out
a pointer to the function text, you need to hold a refcount.

BUT since the module itself is the only one which can hand these out,
and it unregisters everything it has registered, and all those references
fall to zero, it's trivial to prove that there are no more references to
the module functions.

This (as Al points out by referring to lifetime) is the same problem if you
want to kfree() the thing you've registered: either deregistration is
synchronous or it supplies a callback which does the actual kfree. And most
registration interfaces in the kernel are headed towards this model, and
it can be pressed into service for module removal as well.

Hope that clarifies,
Rusty.
--
there are those who do and those who hang on and you don't see too
many doers quoting their contemporaries. -- Larry McVoy
-
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/