From e51c01b08474ea454a965a937fff0407ab6714c7 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Sat, 25 Mar 2006 03:07:17 -0800 Subject: [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 Cc: Philip Blundell Cc: Jochen Friedrich Cc: "Antonino A. Daplas" Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/serial/8250_hp300.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/serial/8250_hp300.c') diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c index 4315afe9c08..53e81a44c1a 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) { -- cgit v1.2.3