Andrew Morton wrote:
> Rusty Russell wrote:
> > module_cleanup should unregister everything first, before doing other
> > cleaning up (which might sleep).
> Yup. module_cleanup() calls unregister_netdev().
> It would be better to do the unregister_netdev(), then to wait for everyone
> to stop using the device (but how?) and to then reap the module.
Two things to remember: one, module_cleanup is called only when module
use count (and hence user count) drops to zero, and two
unregister_netdev closes the net device, so any users that slipped in
and opened the net device during module_cleanup during (is that even
possible?) are booted when the net device is closed. This also takes
care of any wacky hardware cleanup that needs to be done in dev->stop(),
so module_cleanup can simply concern itself with unregistered and
freeing stuff and then exiting.
Jeff Garzik |
Building 1024 | Free beer tomorrow.
MandrakeSoft, Inc. |