aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/zorro/zorro-driver.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-03-25 06:07:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:22:53 -0500
commit33d8675ea66e79d21da3ed64ce88dfb2a18bc6a7 (patch)
tree7283a680e122e4d15f50e818bab188b84fc852a9 /drivers/zorro/zorro-driver.c
parentc2f6fabb2ed3b869bc254c6cdc73d6beaaaf700f (diff)
[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>
Diffstat (limited to 'drivers/zorro/zorro-driver.c')
-rw-r--r--drivers/zorro/zorro-driver.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index fcbee748c592..067c07be928c 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -65,22 +65,17 @@ static int zorro_device_probe(struct device *dev)
65 * @drv: the driver structure to register 65 * @drv: the driver structure to register
66 * 66 *
67 * Adds the driver structure to the list of registered drivers 67 * Adds the driver structure to the list of registered drivers
68 * Returns the number of Zorro devices which were claimed by the driver 68 * Returns zero or a negative error value.
69 * during registration. The driver remains registered even if the
70 * return value is zero.
71 */ 69 */
72 70
73int zorro_register_driver(struct zorro_driver *drv) 71int zorro_register_driver(struct zorro_driver *drv)
74{ 72{
75 int count = 0;
76
77 /* initialize common driver fields */ 73 /* initialize common driver fields */
78 drv->driver.name = drv->name; 74 drv->driver.name = drv->name;
79 drv->driver.bus = &zorro_bus_type; 75 drv->driver.bus = &zorro_bus_type;
80 76
81 /* register with core */ 77 /* register with core */
82 count = driver_register(&drv->driver); 78 return driver_register(&drv->driver);
83 return count ? count : 1;
84} 79}
85 80
86 81