diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2006-03-25 03:07:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 08:22:53 -0800 |
commit | e51c01b08474ea454a965a937fff0407ab6714c7 (patch) | |
tree | 403e22aa86b4a24699df7cc1285ab915ec3eda1a /drivers | |
parent | 5930860296ca438071d3824bf7306ad0dfd33fc1 (diff) | |
download | op-kernel-dev-e51c01b08474ea454a965a937fff0407ab6714c7.zip op-kernel-dev-e51c01b08474ea454a965a937fff0407ab6714c7.tar.gz |
[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')
-rw-r--r-- | drivers/dio/dio-driver.c | 9 | ||||
-rw-r--r-- | drivers/net/hplance.c | 2 | ||||
-rw-r--r-- | drivers/serial/8250_hp300.c | 10 | ||||
-rw-r--r-- | drivers/video/hpfb.c | 4 |
4 files changed, 11 insertions, 14 deletions
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c index ca8e69d..e4c48e3 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) * @drv: the driver structure to register * * Adds the driver structure to the list of registered drivers - * Returns the number of DIO 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 dio_register_driver(struct dio_driver *drv) { - int count = 0; - /* initialize common driver fields */ drv->driver.name = drv->name; drv->driver.bus = &dio_bus_type; /* register with core */ - count = driver_register(&drv->driver); - return count ? count : 1; + return driver_register(&drv->driver); } diff --git a/drivers/net/hplance.c b/drivers/net/hplance.c index d841063..6856934 100644 --- a/drivers/net/hplance.c +++ b/drivers/net/hplance.c @@ -217,7 +217,7 @@ static int hplance_close(struct net_device *dev) int __init hplance_init_module(void) { - return dio_module_init(&hplance_driver); + return dio_register_driver(&hplance_driver); } void __exit hplance_cleanup_module(void) diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c index 4315afe..53e81a4 100644 --- a/drivers/serial/8250_hp300.c +++ b/drivers/serial/8250_hp300.c @@ -55,6 +55,8 @@ static struct dio_driver hpdca_driver = { #endif +static unsigned int num_ports; + extern int hp300_uart_scode; /* Offset to UART registers from base of DCA */ @@ -199,6 +201,8 @@ static int __devinit hpdca_init_one(struct dio_dev *d, out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); udelay(100); + num_ports++; + return 0; } #endif @@ -206,7 +210,6 @@ static int __devinit hpdca_init_one(struct dio_dev *d, static int __init hp300_8250_init(void) { static int called = 0; - int num_ports; #ifdef CONFIG_HPAPCI int line; unsigned long base; @@ -221,11 +224,8 @@ static int __init hp300_8250_init(void) if (!MACH_IS_HP300) return -ENODEV; - num_ports = 0; - #ifdef CONFIG_HPDCA - if (dio_module_init(&hpdca_driver) == 0) - num_ports++; + dio_register_driver(&hpdca_driver); #endif #ifdef CONFIG_HPAPCI if (hp300_model < HP_400) { diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index bebdac5..abd920a 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c @@ -386,7 +386,9 @@ int __init hpfb_init(void) if (fb_get_options("hpfb", NULL)) return -ENODEV; - dio_module_init(&hpfb_driver); + err = dio_register_driver(&hpfb_driver); + if (err) + return err; fs = get_fs(); set_fs(KERNEL_DS); |