use code in module_exit?

Pavel Roskin proski at
Mon Aug 18 18:02:19 BST 2003

On Sun, 17 Aug 2003, Christoph Hellwig wrote:

> All pcmcia drivers have code in module_exit() to walk dev_list
> and call detach on all remaining dev_link_t.  But looking at ds.c
> we see that we get a module reference before each ->attach and release
> the reference only after ->detach so this code is completly superflous.
> That's what my testing with orinoco_cs suggest aswell.
> Can we just rip out lots of long-obsolete code or did I miss something
> obvious?

You can rip it ifyou can guarantee that the driver executes detach()
successfully (perhaps not from the first attempt, but by its own
initiative) no matter what, even if the usermode script fails completely.

Speaking of the network devices (if more familiar with them) it means that
the network device should be unregistered even if it's not brought down by
the script.

Otherwise, unloading the module would unload the code that works with the
network device, which is much worse.  Script failure is not an excuse for
kernel panic.

Pavel Roskin

More information about the linux-pcmcia mailing list