]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/ucc_geth.c
ucc_geth: Fix endless loop in stop_{tx,rx} routines
[linux-2.6-omap-h63xx.git] / drivers / net / ucc_geth.c
index c87747bb24c55eb9ea2ac58992eabfdf348b664b..fa25dc1fcdf1bab31b1c89cae9bede38efe53a9d 100644 (file)
@@ -1615,8 +1615,8 @@ static int init_phy(struct net_device *dev)
        priv->oldspeed = 0;
        priv->oldduplex = -1;
 
-       snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->ug_info->mdio_bus,
-                       priv->ug_info->phy_address);
+       snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus,
+                priv->ug_info->phy_address);
 
        phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
 
@@ -1647,6 +1647,7 @@ static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
        struct ucc_fast_private *uccf;
        u32 cecr_subblock;
        u32 temp;
+       int i = 10;
 
        uccf = ugeth->uccf;
 
@@ -1664,8 +1665,9 @@ static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
 
        /* Wait for command to complete */
        do {
+               msleep(10);
                temp = in_be32(uccf->p_ucce);
-       } while (!(temp & UCCE_GRA));
+       } while (!(temp & UCCE_GRA) && --i);
 
        uccf->stopped_tx = 1;
 
@@ -1677,6 +1679,7 @@ static int ugeth_graceful_stop_rx(struct ucc_geth_private * ugeth)
        struct ucc_fast_private *uccf;
        u32 cecr_subblock;
        u8 temp;
+       int i = 10;
 
        uccf = ugeth->uccf;
 
@@ -1694,9 +1697,9 @@ static int ugeth_graceful_stop_rx(struct ucc_geth_private * ugeth)
                                                ucc_num);
                qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock,
                             QE_CR_PROTOCOL_ETHERNET, 0);
-
+               msleep(10);
                temp = in_8(&ugeth->p_rx_glbl_pram->rxgstpack);
-       } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX));
+       } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX) && --i);
 
        uccf->stopped_rx = 1;
 
@@ -3502,8 +3505,6 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
                        netif_receive_skb(skb);
                }
 
-               ugeth->dev->last_rx = jiffies;
-
                skb = get_new_skb(ugeth, bd);
                if (!skb) {
                        if (netif_msg_rx_err(ugeth))