aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dio/dio-driver.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-03-25 06:07:17 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:22:53 -0500
commite51c01b08474ea454a965a937fff0407ab6714c7 (patch)
tree403e22aa86b4a24699df7cc1285ab915ec3eda1a /drivers/dio/dio-driver.c
parent5930860296ca438071d3824bf7306ad0dfd33fc1 (diff)
[PATCH] hp300: fix driver_register() return handling, remove dio_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. dio_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 dio_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: Philip Blundell <philb@gnu.org> Cc: Jochen Friedrich <jochen@scram.de> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/dio/dio-driver.c')
-rw-r--r--drivers/dio/dio-driver.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c
index ca8e69d2f64d..e4c48e329367 100644
--- a/drivers/dio/dio-driver.c
+++ b/drivers/dio/dio-driver.c
@@ -71,22 +71,17 @@ static int dio_device_probe(struct device *dev)
71 * @drv: the driver structure to register 71 * @drv: the driver structure to register
72 * 72 *
73 * Adds the driver structure to the list of registered drivers 73 * Adds the driver structure to the list of registered drivers
74 * Returns the number of DIO devices which were claimed by the driver 74 * Returns zero or a negative error value.
75 * during registration. The driver remains registered even if the
76 * return value is zero.
77 */ 75 */
78 76
79int dio_register_driver(struct dio_driver *drv) 77int dio_register_driver(struct dio_driver *drv)
80{ 78{
81 int count = 0;
82
83 /* initialize common driver fields */ 79 /* initialize common driver fields */
84 drv->driver.name = drv->name; 80 drv->driver.name = drv->name;
85 drv->driver.bus = &dio_bus_type; 81 drv->driver.bus = &dio_bus_type;
86 82
87 /* register with core */ 83 /* register with core */
88 count = driver_register(&drv->driver); 84 return driver_register(&drv->driver);
89 return count ? count : 1;
90} 85}
91 86
92 87