patch-2.1.105 linux/drivers/net/ne.c

Next file: linux/drivers/net/ne2k-pci.c
Previous file: linux/drivers/net/lne390.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.104/linux/drivers/net/ne.c linux/drivers/net/ne.c
@@ -225,6 +225,7 @@
 		printk("ne.c: PCI BIOS reports %s at i/o %#x, irq %d.\n",
 				pci_clone_list[i].name,
 				pci_ioaddr, pci_irq_line);
+		printk("*\n* Use of the PCI-NE2000 driver with this card is recommended!\n*\n");
 		if (ne_probe1(dev, pci_ioaddr) != 0) {	/* Shouldn't happen. */
 			printk(KERN_ERR "ne.c: Probe of PCI card at %#x failed.\n", pci_ioaddr);
 			pci_irq_line = 0;
@@ -265,6 +266,9 @@
 	}
     }
 
+    if (load_8390_module("ne.c"))
+	return -ENOSYS;
+
     /* We should have a "dev" from Space.c or the static module table. */
     if (dev == NULL) {
 	printk(KERN_ERR "ne.c: Passed a NULL device.\n");
@@ -434,6 +438,7 @@
 	    printk (" unable to get IRQ %d (irqval=%d).\n", dev->irq, irqval);
 
             kfree(dev->priv);
+	    dev->priv = NULL;
 	    return EAGAIN;
 	}
     }
@@ -755,15 +760,17 @@
 			found++;
 			continue;
 		}
-		if (found != 0) 	/* Got at least one. */
+		if (found != 0) { 	/* Got at least one. */
+			lock_8390_module();
 			return 0;
+		}
 		if (io[this_dev] != 0)
 			printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", io[this_dev]);
 		else
 			printk(KERN_NOTICE "ne.c: No PCI cards found. Use \"io=0xNNN\" value(s) for ISA cards.\n");
 		return -ENXIO;
 	}
-
+	lock_8390_module();
 	return 0;
 }
 
@@ -775,13 +782,15 @@
 	for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
 		struct device *dev = &dev_ne[this_dev];
 		if (dev->priv != NULL) {
+			void *priv = dev->priv;
 			free_irq(dev->irq, dev);
 			release_region(dev->base_addr, NE_IO_EXTENT);
-			unregister_netdev(dev);
-			kfree(dev->priv);
 			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