patch-2.3.45 linux/net/wanrouter/wanmain.c

Next file: linux/scripts/tkcond.c
Previous file: linux/net/rose/rose_dev.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.44/linux/net/wanrouter/wanmain.c linux/net/wanrouter/wanmain.c
@@ -526,7 +526,10 @@
 	for (dev = wandev->dev; dev;)
 	{
 		if (delete_interface(wandev, dev->name, 0))
-			dev = dev->slave;
+		{
+			struct net_device **slave = dev->priv;
+			dev = *slave;
+		}
 	}
 	if (wandev->ndev)
 		return -EBUSY;	/* there are opened interfaces  */
@@ -608,8 +611,10 @@
 #endif				
 			err = register_netdev(dev);
 			if (!err) {
+				struct net_device **slave = dev->priv;
+
 				cli();	/***** critical section start *****/
-				dev->slave = wandev->dev;
+				*slave = wandev->dev;
 				wandev->dev = dev;
 				++wandev->ndev;
 				sti();	/****** critical section end ******/
@@ -684,14 +689,19 @@
 {
 	struct net_device *dev, *prev;
 
-	for (dev = wandev->dev, prev = NULL;
-		dev && strcmp(name, dev->name);
-		prev = dev, dev = dev->slave);
+	dev = wandev->dev;
+	prev = NULL;
+	while (dev && strcmp(name, dev->name)) {
+		struct net_device **slave = dev->priv;
+
+		prev = dev;
+		dev = *slave;
+	}
 
 	if (dev == NULL)
 		return -ENODEV;	/* interface not found */
 
-	if (dev->start) {
+	if (test_bit(LINK_STATE_START, &dev->state)) {
 		if (force) {
 			printk(KERN_WARNING
 				"%s: deleting opened interface %s!\n",
@@ -705,10 +715,16 @@
 		wandev->del_if(wandev, dev);
 
 	cli();			/***** critical section start *****/
-	if (prev)
-		prev->slave = dev->slave;
-	else
-		wandev->dev = dev->slave;
+	if (prev) {
+		struct net_device **prev_slave = prev->priv;
+		struct net_device **slave = dev->priv;
+
+		*prev_slave = *slave;
+	} else {
+		struct net_device **slave = dev->priv;
+
+		wandev->dev = *slave;
+	}
 	--wandev->ndev;
 	sti();			/****** critical section end ******/
 

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen (who was at: [email protected])