Fixed segfault on link change in e100 drivers.
authorFlorian Pose <fp@igh-essen.com>
Wed, 15 Jul 2009 09:39:45 +0000
changeset 1502 9715a5599590
parent 1501 59990318c95b
child 1503 b7881d01f98b
Fixed segfault on link change in e100 drivers.
devices/e100-2.6.20-ethercat.c
devices/e100-2.6.24-ethercat.c
devices/e100-2.6.26-ethercat.c
devices/e100-2.6.28-ethercat.c
--- a/devices/e100-2.6.20-ethercat.c	Mon Jul 13 15:26:28 2009 +0000
+++ b/devices/e100-2.6.20-ethercat.c	Wed Jul 15 09:39:45 2009 +0000
@@ -1635,9 +1635,9 @@
 		} else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
 			DPRINTK(LINK, INFO, "link down\n");
 		}
-	}
-
-	mii_check_link(&nic->mii);
+
+		mii_check_link(&nic->mii);
+	}
 
 	if (!nic->ecdev) {
 		/* Software generated interrupt to recover from (rare) Rx
@@ -1649,23 +1649,22 @@
 		writeb(readb(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
 		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
-	}
-
-	e100_update_stats(nic);
-	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
-
-	if(nic->mac <= mac_82557_D100_C)
-		/* Issue a multicast command to workaround a 557 lock up */
-		e100_set_multicast_list(nic->netdev);
-
-	if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
-		/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
-		nic->flags |= ich_10h_workaround;
-	else
-		nic->flags &= ~ich_10h_workaround;
-
-    if (!nic->ecdev)
+
+		e100_update_stats(nic);
+		e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
+
+		if(nic->mac <= mac_82557_D100_C)
+			/* Issue a multicast command to workaround a 557 lock up */
+			e100_set_multicast_list(nic->netdev);
+
+		if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
+			/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
+			nic->flags |= ich_10h_workaround;
+		else
+			nic->flags &= ~ich_10h_workaround;
+
 		mod_timer(&nic->watchdog, jiffies + E100_WATCHDOG_PERIOD);
+	}
 }
 
 static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
--- a/devices/e100-2.6.24-ethercat.c	Mon Jul 13 15:26:28 2009 +0000
+++ b/devices/e100-2.6.24-ethercat.c	Wed Jul 15 09:39:45 2009 +0000
@@ -1651,9 +1651,9 @@
 		} else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
 			DPRINTK(LINK, INFO, "link down\n");
 		}
-	}
-
-	mii_check_link(&nic->mii);
+
+		mii_check_link(&nic->mii);
+	}
 
 	if (!nic->ecdev) {
 		/* Software generated interrupt to recover from (rare) Rx
@@ -1665,24 +1665,23 @@
 		iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
 		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
-	}
-
-	e100_update_stats(nic);
-	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
-
-	if(nic->mac <= mac_82557_D100_C)
-		/* Issue a multicast command to workaround a 557 lock up */
-		e100_set_multicast_list(nic->netdev);
-
-	if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
-		/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
-		nic->flags |= ich_10h_workaround;
-	else
-		nic->flags &= ~ich_10h_workaround;
-
-	if (!nic->ecdev)
+
+		e100_update_stats(nic);
+		e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
+
+		if(nic->mac <= mac_82557_D100_C)
+			/* Issue a multicast command to workaround a 557 lock up */
+			e100_set_multicast_list(nic->netdev);
+
+		if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
+			/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
+			nic->flags |= ich_10h_workaround;
+		else
+			nic->flags &= ~ich_10h_workaround;
+
 		mod_timer(&nic->watchdog,
 				round_jiffies(jiffies + E100_WATCHDOG_PERIOD));
+	}
 }
 
 static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
--- a/devices/e100-2.6.26-ethercat.c	Mon Jul 13 15:26:28 2009 +0000
+++ b/devices/e100-2.6.26-ethercat.c	Wed Jul 15 09:39:45 2009 +0000
@@ -1658,9 +1658,9 @@
 		} else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
 			DPRINTK(LINK, INFO, "link down\n");
 		}
-	}
-
-	mii_check_link(&nic->mii);
+
+		mii_check_link(&nic->mii);
+	}
 
 	if (!nic->ecdev) {
 		/* Software generated interrupt to recover from (rare) Rx
@@ -1672,24 +1672,23 @@
 		iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
 		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
-	}
-
-	e100_update_stats(nic);
-	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
-
-	if(nic->mac <= mac_82557_D100_C)
-		/* Issue a multicast command to workaround a 557 lock up */
-		e100_set_multicast_list(nic->netdev);
-
-	if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
-		/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
-		nic->flags |= ich_10h_workaround;
-	else
-		nic->flags &= ~ich_10h_workaround;
-
-	if (!nic->ecdev)
+
+		e100_update_stats(nic);
+		e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
+
+		if(nic->mac <= mac_82557_D100_C)
+			/* Issue a multicast command to workaround a 557 lock up */
+			e100_set_multicast_list(nic->netdev);
+
+		if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
+			/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
+			nic->flags |= ich_10h_workaround;
+		else
+			nic->flags &= ~ich_10h_workaround;
+
 		mod_timer(&nic->watchdog,
 				round_jiffies(jiffies + E100_WATCHDOG_PERIOD));
+	}
 }
 
 static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
--- a/devices/e100-2.6.28-ethercat.c	Mon Jul 13 15:26:28 2009 +0000
+++ b/devices/e100-2.6.28-ethercat.c	Wed Jul 15 09:39:45 2009 +0000
@@ -1658,9 +1658,9 @@
 		} else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
 			DPRINTK(LINK, INFO, "link down\n");
 		}
-	}
-
-	mii_check_link(&nic->mii);
+
+		mii_check_link(&nic->mii);
+	}
 
 	if (!nic->ecdev) {
 		/* Software generated interrupt to recover from (rare) Rx
@@ -1672,24 +1672,23 @@
 		iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
 		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
-	}
-
-	e100_update_stats(nic);
-	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
-
-	if(nic->mac <= mac_82557_D100_C)
-		/* Issue a multicast command to workaround a 557 lock up */
-		e100_set_multicast_list(nic->netdev);
-
-	if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
-		/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
-		nic->flags |= ich_10h_workaround;
-	else
-		nic->flags &= ~ich_10h_workaround;
-
-	if (!nic->ecdev)
+
+		e100_update_stats(nic);
+		e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
+
+		if(nic->mac <= mac_82557_D100_C)
+			/* Issue a multicast command to workaround a 557 lock up */
+			e100_set_multicast_list(nic->netdev);
+
+		if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
+			/* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
+			nic->flags |= ich_10h_workaround;
+		else
+			nic->flags &= ~ich_10h_workaround;
+
 		mod_timer(&nic->watchdog,
 				round_jiffies(jiffies + E100_WATCHDOG_PERIOD));
+	}
 }
 
 static void e100_xmit_prepare(struct nic *nic, struct cb *cb,