[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:
Bjorn Helgaas
2006-03-25 03:07:20 -08:00
committed by Linus Torvalds
parent c2f6fabb2e
commit 33d8675ea6
7 changed files with 7 additions and 45 deletions

View File

@@ -65,22 +65,17 @@ static int zorro_device_probe(struct device *dev)
* @drv: the driver structure to register
*
* Adds the driver structure to the list of registered drivers
* Returns the number of Zorro devices which were claimed by the driver
* during registration. The driver remains registered even if the
* return value is zero.
* Returns zero or a negative error value.
*/
int zorro_register_driver(struct zorro_driver *drv)
{
int count = 0;
/* initialize common driver fields */
drv->driver.name = drv->name;
drv->driver.bus = &zorro_bus_type;
/* register with core */
count = driver_register(&drv->driver);
return count ? count : 1;
return driver_register(&drv->driver);
}