diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-07-22 18:41:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-22 18:41:24 -0400 |
commit | c8f15686a4b3345e3e81e09cfe191df58bbedd45 (patch) | |
tree | 1990e6281c5ced09566b093c599b7022f7bb4eb8 | |
parent | 3d0f24a74e7957593a5622eb5c04ed6860dd8391 (diff) |
netdev: bunch of drivers: avoid WARN at net/core/dev.c:1328
The drivers were touching net queue before it has been started, so
without this patch, the drivers will potentially WARN at
net/core/dev.c:1328.
I don't have the hardware for the drivers below, so this patch is
untested, and thus should be carefully peer reviewed.
tc35815.c
au1000_eth.c
bfin_mac.c
macb.c
^ The four drivers are using phylib, they're calling netif_start_queue()
in open() callback. So trivially remove netif_tx_schedule_all().
Phylib will handle netif_carrier_*().
cpmac.c
fec_mpc52xx.c
fs_enet/fs_enet-main.c
sh_eth.c
^ The same as above, but these were also needlessly calling
netif_carrier_*() functions. So removed queue calls and also remove
carrier calls, since phylib will handle it. fs_enet-main.c also didn't
call netif_start_queue() at open(), this is fixed now.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/au1000_eth.c | 5 | ||||
-rw-r--r-- | drivers/net/bfin_mac.c | 1 | ||||
-rw-r--r-- | drivers/net/cpmac.c | 2 | ||||
-rw-r--r-- | drivers/net/fec_mpc52xx.c | 5 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 7 | ||||
-rw-r--r-- | drivers/net/macb.c | 4 | ||||
-rw-r--r-- | drivers/net/sh_eth.c | 5 | ||||
-rw-r--r-- | drivers/net/tc35815.c | 1 |
8 files changed, 5 insertions, 25 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 3ab61e40e86a..cb8be490e5ae 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -911,9 +911,8 @@ au1000_adjust_link(struct net_device *dev) | |||
911 | if(phydev->link != aup->old_link) { | 911 | if(phydev->link != aup->old_link) { |
912 | // link state changed | 912 | // link state changed |
913 | 913 | ||
914 | if (phydev->link) // link went up | 914 | if (!phydev->link) { |
915 | netif_tx_schedule_all(dev); | 915 | /* link went down */ |
916 | else { // link went down | ||
917 | aup->old_speed = 0; | 916 | aup->old_speed = 0; |
918 | aup->old_duplex = -1; | 917 | aup->old_duplex = -1; |
919 | } | 918 | } |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index a6a3da89f590..a8ec60e1ed75 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -357,7 +357,6 @@ static void bfin_mac_adjust_link(struct net_device *dev) | |||
357 | if (!lp->old_link) { | 357 | if (!lp->old_link) { |
358 | new_state = 1; | 358 | new_state = 1; |
359 | lp->old_link = 1; | 359 | lp->old_link = 1; |
360 | netif_tx_schedule_all(dev); | ||
361 | } | 360 | } |
362 | } else if (lp->old_link) { | 361 | } else if (lp->old_link) { |
363 | new_state = 1; | 362 | new_state = 1; |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index fbd4280c102c..a7800e559090 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -945,10 +945,8 @@ static void cpmac_adjust_link(struct net_device *dev) | |||
945 | if (!priv->oldlink) { | 945 | if (!priv->oldlink) { |
946 | new_state = 1; | 946 | new_state = 1; |
947 | priv->oldlink = 1; | 947 | priv->oldlink = 1; |
948 | netif_tx_schedule_all(dev); | ||
949 | } | 948 | } |
950 | } else if (priv->oldlink) { | 949 | } else if (priv->oldlink) { |
951 | netif_tx_stop_all_queues(dev); | ||
952 | new_state = 1; | 950 | new_state = 1; |
953 | priv->oldlink = 0; | 951 | priv->oldlink = 0; |
954 | priv->oldspeed = 0; | 952 | priv->oldspeed = 0; |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index ae9ecb7df22b..4e4f68304e82 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -197,9 +197,6 @@ static void mpc52xx_fec_adjust_link(struct net_device *dev) | |||
197 | if (priv->link == PHY_DOWN) { | 197 | if (priv->link == PHY_DOWN) { |
198 | new_state = 1; | 198 | new_state = 1; |
199 | priv->link = phydev->link; | 199 | priv->link = phydev->link; |
200 | netif_tx_schedule_all(dev); | ||
201 | netif_carrier_on(dev); | ||
202 | netif_start_queue(dev); | ||
203 | } | 200 | } |
204 | 201 | ||
205 | } else if (priv->link) { | 202 | } else if (priv->link) { |
@@ -207,8 +204,6 @@ static void mpc52xx_fec_adjust_link(struct net_device *dev) | |||
207 | priv->link = PHY_DOWN; | 204 | priv->link = PHY_DOWN; |
208 | priv->speed = 0; | 205 | priv->speed = 0; |
209 | priv->duplex = -1; | 206 | priv->duplex = -1; |
210 | netif_stop_queue(dev); | ||
211 | netif_carrier_off(dev); | ||
212 | } | 207 | } |
213 | 208 | ||
214 | if (new_state && netif_msg_link(priv)) | 209 | if (new_state && netif_msg_link(priv)) |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 445763e5648e..52911889fd12 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -738,9 +738,6 @@ static void generic_adjust_link(struct net_device *dev) | |||
738 | if (!fep->oldlink) { | 738 | if (!fep->oldlink) { |
739 | new_state = 1; | 739 | new_state = 1; |
740 | fep->oldlink = 1; | 740 | fep->oldlink = 1; |
741 | netif_tx_schedule_all(dev); | ||
742 | netif_carrier_on(dev); | ||
743 | netif_start_queue(dev); | ||
744 | } | 741 | } |
745 | 742 | ||
746 | if (new_state) | 743 | if (new_state) |
@@ -750,8 +747,6 @@ static void generic_adjust_link(struct net_device *dev) | |||
750 | fep->oldlink = 0; | 747 | fep->oldlink = 0; |
751 | fep->oldspeed = 0; | 748 | fep->oldspeed = 0; |
752 | fep->oldduplex = -1; | 749 | fep->oldduplex = -1; |
753 | netif_carrier_off(dev); | ||
754 | netif_stop_queue(dev); | ||
755 | } | 750 | } |
756 | 751 | ||
757 | if (new_state && netif_msg_link(fep)) | 752 | if (new_state && netif_msg_link(fep)) |
@@ -826,6 +821,8 @@ static int fs_enet_open(struct net_device *dev) | |||
826 | } | 821 | } |
827 | phy_start(fep->phydev); | 822 | phy_start(fep->phydev); |
828 | 823 | ||
824 | netif_start_queue(dev); | ||
825 | |||
829 | return 0; | 826 | return 0; |
830 | } | 827 | } |
831 | 828 | ||
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0496d16f9de5..daba82bbcb56 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -164,9 +164,7 @@ static void macb_handle_link_change(struct net_device *dev) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | if (phydev->link != bp->link) { | 166 | if (phydev->link != bp->link) { |
167 | if (phydev->link) | 167 | if (!phydev->link) { |
168 | netif_tx_schedule_all(dev); | ||
169 | else { | ||
170 | bp->speed = 0; | 168 | bp->speed = 0; |
171 | bp->duplex = -1; | 169 | bp->duplex = -1; |
172 | } | 170 | } |
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index a4bc812aa999..c69ba1395fa9 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -642,17 +642,12 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
642 | | ECMR_DM, ioaddr + ECMR); | 642 | | ECMR_DM, ioaddr + ECMR); |
643 | new_state = 1; | 643 | new_state = 1; |
644 | mdp->link = phydev->link; | 644 | mdp->link = phydev->link; |
645 | netif_tx_schedule_all(ndev); | ||
646 | netif_carrier_on(ndev); | ||
647 | netif_start_queue(ndev); | ||
648 | } | 645 | } |
649 | } else if (mdp->link) { | 646 | } else if (mdp->link) { |
650 | new_state = 1; | 647 | new_state = 1; |
651 | mdp->link = PHY_DOWN; | 648 | mdp->link = PHY_DOWN; |
652 | mdp->speed = 0; | 649 | mdp->speed = 0; |
653 | mdp->duplex = -1; | 650 | mdp->duplex = -1; |
654 | netif_stop_queue(ndev); | ||
655 | netif_carrier_off(ndev); | ||
656 | } | 651 | } |
657 | 652 | ||
658 | if (new_state) | 653 | if (new_state) |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index 41d3ac45685f..a645e5028c14 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -672,7 +672,6 @@ static void tc_handle_link_change(struct net_device *dev) | |||
672 | if (dev->flags & IFF_PROMISC) | 672 | if (dev->flags & IFF_PROMISC) |
673 | tc35815_set_multicast_list(dev); | 673 | tc35815_set_multicast_list(dev); |
674 | #endif | 674 | #endif |
675 | netif_tx_schedule_all(dev); | ||
676 | } else { | 675 | } else { |
677 | lp->speed = 0; | 676 | lp->speed = 0; |
678 | lp->duplex = -1; | 677 | lp->duplex = -1; |