Skip to contentSkip to conversation

2.5.60 3c509 & net/Space.c problem

PATCH Mikael Pettersson 3 participants 3 messages Feb 11, 2003 – Feb 12, 2003 Network drivers

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

From Linus' 2.5.60 announcement:

James Bottomley <[email protected]>:
o 3c509 fixes: correct MCA probing, add back ISA probe to Space.c

This is somewhat broken. patch-2.5.60 has

drivers/net/Space.c Mon Feb 10 10:39:23 2003 +3 -0
@@ -224,6 +224,9 @@
 #ifdef CONFIG_EL2              /* 3c503 */
        {el2_probe, 0},
 #endif
+#ifdef CONFIG_EL3
+       {el3_probe, 0},
+#endif
 #ifdef CONFIG_HPLAN
        {hp_probe, 0},
 #endif

but (a) there's no declaration for el3_probe() in scope at this point, leading to a compile error, and (b) el3_probe() is still 'static' in 3c509.c, leading to a linkage error (assuming a declaration for el3_probe() was added to Space.c to fix (a) first)

Reverting the patch to Space.c solved the problem for me.

Why the probe list entry? Isn't the module_init() in 3c509.c enough?

/Mikael

#1 lore raw
Quoted 9 lines · Mikael Pettersson
Quoted 5 lines

From Linus' 2.5.60 announcement:

James Bottomley <[email protected]>:
o 3c509 fixes: correct MCA probing, add back ISA probe to Space.c

This is somewhat broken. patch-2.5.60 has

I'm looking for someone to pump some bytes through this fix.

Patch from Marc Zyngier <[email protected]>

 drivers/net/3c509.c |   66 +++++++++++++++++++++++++++++-----------------------
 drivers/net/Space.c |    3 --
 2 files changed, 37 insertions(+), 32 deletions(-)
drivers/net/3c509.c renamed from drivers/net/3c509.c~3c509 +37 -29
diff -puN drivers/net/3c509.c~3c509 drivers/net/3c509.c
@@ -338,16 +338,6 @@ static int __init el3_common_init (struc
 	dev->watchdog_timeo = TX_TIMEOUT;
 	dev->do_ioctl = netdev_ioctl;
 
-#ifdef CONFIG_PM
-	/* register power management */
-	lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback);
-	if (lp->pmdev) {
-		struct pm_dev *p;
-		p = lp->pmdev;
-		p->data = (struct net_device *)dev;
-	}
-#endif
-
 	return 0;
 }
 
@@ -417,6 +407,13 @@ static int __init el3_probe(int card_idx
 					phys_addr[j] =
 						htons(read_eeprom(ioaddr, j));
 			if_port = read_eeprom(ioaddr, 8) >> 14;
+			if (!(dev = init_etherdev(NULL, sizeof(struct el3_private)))) {
+					release_region(ioaddr, EL3_IO_EXTENT);
+					pnp_device_detach(idev);
+					return -ENOMEM;
+			}
+
+			SET_MODULE_OWNER(dev);
 			pnp_cards++;
 			goto found;
 		}
@@ -497,24 +494,29 @@ no_pnp:
 	}
 	irq = id_read_eeprom(9) >> 12;
 
-#if 0							/* Huh ?
-								   Can someone explain what is this for ? */
-	if (dev) {					/* Set passed-in IRQ or I/O Addr. */
-		if (dev->irq > 1  &&  dev->irq < 16)
+	if (!(dev = init_etherdev(NULL, sizeof(struct el3_private))))
+			return -ENOMEM;
+
+	SET_MODULE_OWNER(dev);
+	
+	/* Set passed-in IRQ or I/O Addr. */
+	if (dev->irq > 1  &&  dev->irq < 16)
 			irq = dev->irq;
 
-		if (dev->base_addr) {
+	if (dev->base_addr) {
 			if (dev->mem_end == 0x3c509 			/* Magic key */
 				&& dev->base_addr >= 0x200  &&  dev->base_addr <= 0x3e0)
-				ioaddr = dev->base_addr & 0x3f0;
-			else if (dev->base_addr != ioaddr)
-				return -ENODEV;
-		}
+					ioaddr = dev->base_addr & 0x3f0;
+			else if (dev->base_addr != ioaddr) {
+					unregister_netdev (dev);
+					return -ENODEV;
+			}
 	}
-#endif
 
-	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509"))
-		return -EBUSY;
+	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509")) {
+			unregister_netdev (dev);
+			return -EBUSY;
+	}
 
 	/* Set the adaptor tag so that the next card can be found. */
 	outb(0xd0 + ++current_tag, id_port);
@@ -524,19 +526,15 @@ no_pnp:
 
 	EL3WINDOW(0);
 	if (inw(ioaddr) != 0x6d50) {
+		unregister_netdev (dev);
 		release_region(ioaddr, EL3_IO_EXTENT);
 		return -ENODEV;
 	}
 
 	/* Free the interrupt so that some other card can use it. */
 	outw(0x0f00, ioaddr + WN0_IRQ);
-
-	dev = init_etherdev(NULL, sizeof(struct el3_private));
-	if (dev == NULL) {
-	    release_region(ioaddr, EL3_IO_EXTENT);
-		return -ENOMEM;
-	}
-	SET_MODULE_OWNER(dev);
+	
+ found:							/* PNP jumps here... */
 
 	memcpy(dev->dev_addr, phys_addr, sizeof(phys_addr));
 	dev->base_addr = ioaddr;
@@ -547,6 +545,16 @@ no_pnp:
 	lp->dev = &idev->dev;
 #endif
 
+#ifdef CONFIG_PM
+	/* register power management */
+	lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback);
+	if (lp->pmdev) {
+		struct pm_dev *p;
+		p = lp->pmdev;
+		p->data = (struct net_device *)dev;
+	}
+#endif
+
 	return el3_common_init (dev);
 }
 
drivers/net/Space.c renamed from drivers/net/Space.c~3c509 +0 -3
diff -puN drivers/net/Space.c~3c509 drivers/net/Space.c
@@ -224,9 +224,6 @@ static struct devprobe isa_probes[] __in
 #ifdef CONFIG_EL2 		/* 3c503 */
 	{el2_probe, 0},
 #endif
-#ifdef CONFIG_EL3
-	{el3_probe, 0},
-#endif
 #ifdef CONFIG_HPLAN
 	{hp_probe, 0},
 #endif

_

#2 lore raw

Andrew Morton <[email protected]>, on Mon Feb 10, 2003 [06:26:19 PM] said:
[...]

Quoted 11 lines

I'm looking for someone to pump some bytes through this fix.

Patch from Marc Zyngier <[email protected]>

 drivers/net/3c509.c |   66 +++++++++++++++++++++++++++++-----------------------
 drivers/net/Space.c |    3 --
 2 files changed, 37 insertions(+), 32 deletions(-)
	Hi;

	Tested this under 2.5.60, and Marc's other patch against

2.5.59 -- compiles and works.

eth0 Link encap:Ethernet HWaddr 00:60:8C:CB:99:78

          inet addr:192.168.2.21  Bcast:192.168.2.255 Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING  MTU:1500  Metric:1
          RX packets:946103 errors:62 dropped:0 overruns:56 frame:62
          TX packets:360895 errors:0 dropped:0 overruns:0 carrier:0
          collisions:45706 txqueuelen:100 
          RX bytes:1190605511 (1135.4 Mb)  TX bytes:357493752 (340.9 Mb)
          Interrupt:10 Base address:0x300 

	RX errors increase under just about any load, similar to

2.4 kernel-- this traffic is over effectively a 2 computer network. The machine is a k6-II 333. I dont think Ive ever noticed errors with a wd8013 in this box....

Paul
[email protected]