patch-2.1.105 linux/drivers/net/3c503.c

Next file: linux/drivers/net/8390.c
Previous file: linux/drivers/misc/parport_share.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.104/linux/drivers/net/3c503.c linux/drivers/net/3c503.c
@@ -186,6 +186,9 @@
 	return ENODEV;
     }
 
+    if (load_8390_module("3c503.c"))
+	return -ENOSYS;
+
     /* We should have a "dev" from Space.c or the static module table. */
     if (dev == NULL) {
 	printk("3c503.c: Passed a NULL device.\n");
@@ -346,7 +349,7 @@
 		outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR);
 		outb_p(0x00, E33G_IDCFR);
 		if (*irqp == autoirq_report(0)	 /* It's a good IRQ line! */
-		    && request_irq (dev->irq = *irqp, &ei_interrupt, 0, ei_status.name, dev) == 0)
+		    && request_irq (dev->irq = *irqp, ei_interrupt, 0, ei_status.name, dev) == 0)
 		    break;
 	    }
 	} while (*++irqp);
@@ -355,7 +358,7 @@
 	    return -EAGAIN;
 	}
     } else {
-	if (request_irq(dev->irq, &ei_interrupt, 0, ei_status.name, dev)) {
+	if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev)) {
 	    return -EAGAIN;
 	}
     }
@@ -658,11 +661,15 @@
 		}
 		if (register_netdev(dev) != 0) {
 			printk(KERN_WARNING "3c503.c: No 3c503 card found (i/o = 0x%x).\n", io[this_dev]);
-			if (found != 0) return 0;	/* Got at least one. */
+			if (found != 0) {	/* Got at least one. */
+				lock_8390_module();
+				return 0;
+			}
 			return -ENXIO;
 		}
 		found++;
 	}
+	lock_8390_module();
 	return 0;
 }
 
@@ -674,13 +681,15 @@
 	for (this_dev = 0; this_dev < MAX_EL2_CARDS; this_dev++) {
 		struct device *dev = &dev_el2[this_dev];
 		if (dev->priv != NULL) {
+			void *priv = dev->priv;
 			/* NB: el2_close() handles free_irq */
-			unregister_netdev(dev);
-			kfree(dev->priv);
-			dev->priv = NULL;
 			release_region(dev->base_addr, EL2_IO_EXTENT);
+			dev->priv = NULL;
+			unregister_netdev(dev);
+			kfree(priv);
 		}
 	}
+	unlock_8390_module();
 }
 #endif /* MODULE */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov