[PATCH 2.5] Fix depca ISA/EISA init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff,

The enclosed patch fixes a problem where we were trying to register
the EISA depca driver multiple times if a depca ISA card was found
(depca_probe is called multiple times by Space.c).

Also switch away from init_etherdev to alloc_etherdev for EISA cards.

Tested on x86 (ISA) and Alpha (EISA).

Thanks,

        M.

diff -ruN linux-latest/drivers/net/depca.c linux-eisa/drivers/net/depca.c
--- linux-latest/drivers/net/depca.c	2003-07-04 09:41:34.000000000 +0200
+++ linux-eisa/drivers/net/depca.c	2003-07-04 09:43:37.000000000 +0200
@@ -529,7 +529,14 @@
 #endif
 		isa_probe(dev, iobase);
 #ifdef CONFIG_EISA
-		eisa_driver_register (&depca_eisa_driver);
+		{
+			static int been_there = 0;
+
+			if (!been_there) {
+				been_there = 1;
+				eisa_driver_register (&depca_eisa_driver);
+			}
+		}
 #endif
 
 		if ((tmp == num_depcas) && (iobase != 0) && loading_module) {
@@ -781,9 +788,8 @@
 	if (!is_eisa) {
 		kfree(dev->priv);
 		dev->priv = NULL;
-	} else {
-		unregister_netdev (dev);
 	}
+	
 	return status;
 }
 
@@ -1520,19 +1526,25 @@
 		goto out_release;
 	}
 
-	if (!(dev = init_etherdev (NULL, sizeof (struct depca_private)))) {
+	if (!(dev = alloc_etherdev (sizeof (struct depca_private)))) {
 		status = -ENOMEM;
 		goto out_release;
 	}
 		
+        SET_NETDEV_DEV(dev, device);
 	eisa_set_drvdata (edev, dev);
 
-	if ((status = depca_hw_init(dev, iobase, -1)))
+	if ((status = register_netdev (dev)))
 		goto out_free;
+	
+	if ((status = depca_hw_init(dev, iobase, -1)))
+		goto out_unreg;
 
 	num_depcas++;
 	return 0;
 
+ out_unreg:
+	unregister_netdev (dev);
  out_free:
 	kfree (dev);
  out_release:

-- 
Places change, faces change. Life is so very strange.
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux