patch-2.4.9 linux/drivers/net/ariadne.c

Next file: linux/drivers/net/de600.c
Previous file: linux/drivers/net/acenic.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.8/linux/drivers/net/ariadne.c linux/drivers/net/ariadne.c
@@ -160,24 +160,29 @@
 	unsigned long board = z->resource.start;
 	unsigned long base_addr = board+ARIADNE_LANCE;
 	unsigned long mem_start = board+ARIADNE_RAM;
+	struct resource *r1, *r2;
 
-	if (!request_mem_region(base_addr, sizeof(struct Am79C960),
-		    		"Am79C960"))
-	    continue;
-	if (!request_mem_region(mem_start, ARIADNE_RAM_SIZE, "RAM")) {
-	    release_mem_region(base_addr, sizeof(struct Am79C960));
+	r1 = request_mem_region(base_addr, sizeof(struct Am79C960),
+		    		"Am79C960");
+	if (!r1) continue;
+	r2 = request_mem_region(mem_start, ARIADNE_RAM_SIZE, "RAM");
+	if (!r2) {
+	    release_resource(r1);
 	    continue;
 	}
 
 	dev = init_etherdev(NULL, sizeof(struct ariadne_private));
 
 	if (dev == NULL) {
-	    release_mem_region(base_addr, sizeof(struct Am79C960));
-	    release_mem_region(mem_start, ARIADNE_RAM_SIZE);
+	    release_resource(r1);
+	    release_resource(r2);
 	    return -ENOMEM;
 	}
-	priv = (struct ariadne_private *)dev->priv;
-	memset(priv, 0, sizeof(struct ariadne_private));
+	SET_MODULE_OWNER(dev);
+	priv = dev->priv;
+
+	r1->name = dev->name;
+	r2->name = dev->name;
 
 	priv->dev = dev;
 	dev->dev_addr[0] = 0x00;
@@ -218,6 +223,7 @@
     volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
     u_short in;
     u_long version;
+    int i;
 
     /* Reset the LANCE */
     in = lance->Reset;
@@ -307,15 +313,13 @@
 
     netif_start_queue(dev);
 
-    if (request_irq(IRQ_AMIGA_PORTS, ariadne_interrupt, SA_SHIRQ,
-                    "Ariadne Ethernet", dev))
-	return -EAGAIN;
+    i = request_irq(IRQ_AMIGA_PORTS, ariadne_interrupt, SA_SHIRQ,
+                    dev->name, dev);
+    if (i) return i;
 
     lance->RAP = CSR0;		/* PCnet-ISA Controller Status */
     lance->RDP = INEA|STRT;
 
-    MOD_INC_USE_COUNT;
-
     return 0;
 }
 
@@ -388,8 +392,6 @@
     lance->RDP = STOP;
 
     free_irq(IRQ_AMIGA_PORTS, dev);
-
-    MOD_DEC_USE_COUNT;
 
     return 0;
 }

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