Skip to contentSkip to conversation

EISA: tidy-up driver_register() return value

PATCH In review Bjorn Helgaas 2 participants 2 messages Mar 2, 2006 – Mar 3, 2006 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EISA: tidy-up driver_register() return value

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.

drivers/eisa/eisa-bus.c +1 -6
Index: work-mm4/drivers/eisa/eisa-bus.c
===================================================================
@@ -162,13 +162,8 @@
 
 int eisa_driver_register (struct eisa_driver *edrv)
 {
-	int r;
-	
 	edrv->driver.bus = &eisa_bus_type;
-	if ((r = driver_register (&edrv->driver)) < 0)
-		return r;
-
-	return 0;
+	return driver_register (&edrv->driver);
 }
 
 void eisa_driver_unregister (struct eisa_driver *edrv)
drivers/net/3c59x.c +3 -1
Index: work-mm4/drivers/net/3c59x.c
===================================================================
@@ -1087,9 +1087,11 @@
 {
 	int eisa_found = 0;
 	int orig_cards_found = vortex_cards_found;
+	int err;
 
 #ifdef CONFIG_EISA
-	if (eisa_driver_register (&vortex_eisa_driver) >= 0) {
+	err = eisa_driver_register (&vortex_eisa_driver);
+	if (!err) {
 			/* Because of the way EISA bus is probed, we cannot assume
 			 * any device have been found when we exit from
 			 * eisa_driver_register (the bus root driver may not be
drivers/net/dgrs.c +7 -7
Index: work-mm4/drivers/net/dgrs.c
===================================================================
@@ -1551,7 +1551,7 @@
 static int __init dgrs_init_module (void)
 {
 	int	i;
-	int	cardcount = 0;
+	int	err;
 
 	/*
 	 *	Command line variable overrides
@@ -1593,13 +1593,13 @@
 	 *	Find and configure all the cards
 	 */
 #ifdef CONFIG_EISA
-	cardcount = eisa_driver_register(&dgrs_eisa_driver);
-	if (cardcount < 0)
-		return cardcount;
+	err = eisa_driver_register(&dgrs_eisa_driver);
+	if (err)
+		return err;
 #endif
-	cardcount = pci_register_driver(&dgrs_pci_driver);
-	if (cardcount)
-		return cardcount;
+	err = pci_register_driver(&dgrs_pci_driver);
+	if (err)
+		return err;
 	return 0;
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bjorn" == Bjorn Helgaas <[email protected]> writes:

Bjorn> Remove the assumption that driver_register() returns the number Bjorn> of devices bound to the driver. In fact, it returns zero for Bjorn> success or a negative error value.

Bjorn> Signed-off-by: Bjorn Helgaas <[email protected]>

Looks ok to me.

	M.
Signature · 1 line
And if you don't know where you're going, any road will take you there...