aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
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 /include/linux
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 'include/linux')
-rw-r--r--include/linux/dio.h32
1 files changed, 0 insertions, 32 deletions
diff --git a/include/linux/dio.h b/include/linux/dio.h
index fae9395fcf4f..1e65ebc2a3db 100644
--- a/include/linux/dio.h
+++ b/include/linux/dio.h
@@ -276,37 +276,5 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data)
276 dev_set_drvdata(&d->dev, data); 276 dev_set_drvdata(&d->dev, data);
277} 277}
278 278
279/*
280 * A helper function which helps ensure correct dio_driver
281 * setup and cleanup for commonly-encountered hotplug/modular cases
282 *
283 * This MUST stay in a header, as it checks for -DMODULE
284 */
285static inline int dio_module_init(struct dio_driver *drv)
286{
287 int rc = dio_register_driver(drv);
288
289 if (rc > 0)
290 return 0;
291
292 /* iff CONFIG_HOTPLUG and built into kernel, we should
293 * leave the driver around for future hotplug events.
294 * For the module case, a hotplug daemon of some sort
295 * should load a module in response to an insert event. */
296#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
297 if (rc == 0)
298 return 0;
299#else
300 if (rc == 0)
301 rc = -ENODEV;
302#endif
303
304 /* if we get here, we need to clean up DIO driver instance
305 * and return some sort of error */
306 dio_unregister_driver(drv);
307
308 return rc;
309}
310
311#endif /* __KERNEL__ */ 279#endif /* __KERNEL__ */
312#endif /* ndef _LINUX_DIO_H */ 280#endif /* ndef _LINUX_DIO_H */