[PATCH] amiga: fix driver_register() return handling, remove zorro_module_init()
Remove the assumption that driver_register() returns the number of devices bound to the driver. In fact, it returns zero for success or a negative error value. zorro_module_init() used the device count to automatically unregister and unload drivers that found no devices. That might have worked at one time, but has been broken for some time because zorro_register_driver() returned either a negative error or a positive count (never zero). So it could only unregister on failure, when it's not needed anyway. This functionality could be resurrected in individual drivers by counting devices in their .probe() methods. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
c2f6fabb2e
commit
33d8675ea6
@@ -271,39 +271,6 @@ static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* A helper function which helps ensure correct zorro_driver
|
||||
* setup and cleanup for commonly-encountered hotplug/modular cases
|
||||
*
|
||||
* This MUST stay in a header, as it checks for -DMODULE
|
||||
*/
|
||||
static inline int zorro_module_init(struct zorro_driver *drv)
|
||||
{
|
||||
int rc = zorro_register_driver(drv);
|
||||
|
||||
if (rc > 0)
|
||||
return 0;
|
||||
|
||||
/* iff CONFIG_HOTPLUG and built into kernel, we should
|
||||
* leave the driver around for future hotplug events.
|
||||
* For the module case, a hotplug daemon of some sort
|
||||
* should load a module in response to an insert event. */
|
||||
#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
|
||||
if (rc == 0)
|
||||
return 0;
|
||||
#else
|
||||
if (rc == 0)
|
||||
rc = -ENODEV;
|
||||
#endif
|
||||
|
||||
/* if we get here, we need to clean up Zorro driver instance
|
||||
* and return some sort of error */
|
||||
zorro_unregister_driver(drv);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Bitmask indicating portions of available Zorro II RAM that are unused
|
||||
* by the system. Every bit represents a 64K chunk, for a maximum of 8MB
|
||||
|
Reference in New Issue
Block a user