patch-2.4.0-test2 linux/drivers/net/hp-plus.c

Next file: linux/drivers/net/hp.c
Previous file: linux/drivers/net/hamradio/pt.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/net/hp-plus.c linux/drivers/net/hp-plus.c
@@ -131,7 +131,7 @@
 	if (base_addr > 0x1ff)		/* Check a single specified location. */
 		return hpp_probe1(dev, base_addr);
 	else if (base_addr != 0)	/* Don't probe at all. */
-		return ENXIO;
+		return -ENXIO;
 
 	for (i = 0; hpplus_portlist[i]; i++) {
 		int ioaddr = hpplus_portlist[i];
@@ -141,7 +141,7 @@
 			return 0;
 	}
 
-	return ENODEV;
+	return -ENODEV;
 }
 #endif
 
@@ -157,10 +157,7 @@
 	/* Check for the HP+ signature, 50 48 0x 53. */
 	if (inw(ioaddr + HP_ID) != 0x4850
 		|| (inw(ioaddr + HP_PAGING) & 0xfff0) != 0x5300)
-		return ENODEV;
-
-	if (load_8390_module("hp-plus.c"))
-		return -ENOSYS;
+		return -ENODEV;
 
 	/* We should have a "dev" from Space.c or the static module table. */
 	if (dev == NULL) {
@@ -186,7 +183,7 @@
 
 	if (checksum != 0xff) {
 		printk(" bad checksum %2.2x.\n", checksum);
-		return ENODEV;
+		return -ENODEV;
 	} else {
 		/* Point at the Software Configuration Flags. */
 		outw(ID_Page, ioaddr + HP_PAGING);
@@ -436,6 +433,9 @@
 {
 	int this_dev, found = 0;
 
+	if (load_8390_module("hp-plus.c"))
+		return -ENOSYS;
+
 	for (this_dev = 0; this_dev < MAX_HPP_CARDS; this_dev++) {
 		struct net_device *dev = &dev_hpp[this_dev];
 		dev->irq = irq[this_dev];
@@ -448,14 +448,13 @@
 		if (register_netdev(dev) != 0) {
 			printk(KERN_WARNING "hp-plus.c: No HP-Plus card found (i/o = 0x%x).\n", io[this_dev]);
 			if (found != 0) {	/* Got at least one. */
-				lock_8390_module();
 				return 0;
 			}
+			unload_8390_module();
 			return -ENXIO;
 		}
 		found++;
 	}
-	lock_8390_module();
 	return 0;
 }
 
@@ -475,7 +474,7 @@
 			kfree(priv);
 		}
 	}
-	unlock_8390_module();
+	unload_8390_module();
 }
 #endif /* MODULE */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)