net: systemport: only update UMAC_CMD if something changed
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 15 May 2014 02:32:13 +0000 (19:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 May 2014 20:48:38 +0000 (16:48 -0400)
The link adjustment callback can be called as frequently as desired by
the PHY library, as such, let's avoid doing a Read/Modify/Write sequence
if nothing changed, which is more than likely since we are interfaced
with a switch device.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bcmsysport.c

index f66de1344b6eb4c47923fc5ed8612756006a91f6..39503647d8bb5a9df5a7e747783ab0590a301fb4 100644 (file)
@@ -959,15 +959,16 @@ static void bcm_sysport_adj_link(struct net_device *dev)
        if (!phydev->pause)
                cmd_bits |= CMD_RX_PAUSE_IGNORE | CMD_TX_PAUSE_IGNORE;
 
-       reg = umac_readl(priv, UMAC_CMD);
-       reg &= ~((CMD_SPEED_MASK << CMD_SPEED_SHIFT) |
+       if (changed) {
+               reg = umac_readl(priv, UMAC_CMD);
+               reg &= ~((CMD_SPEED_MASK << CMD_SPEED_SHIFT) |
                        CMD_HD_EN | CMD_RX_PAUSE_IGNORE |
                        CMD_TX_PAUSE_IGNORE);
-       reg |= cmd_bits;
-       umac_writel(priv, reg, UMAC_CMD);
+               reg |= cmd_bits;
+               umac_writel(priv, reg, UMAC_CMD);
 
-       if (changed)
                phy_print_status(priv->phydev);
+       }
 }
 
 static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,