From: LABBE Corentin Date: Wed, 15 Feb 2017 09:46:43 +0000 (+0100) Subject: net: stmmac: split the stmmac_adjust_link 10/100 case X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9beae261baab3f5a3001933cbc4d321538bef344;p=openwrt%2Fstaging%2Fblogic.git net: stmmac: split the stmmac_adjust_link 10/100 case The 10/100 case have too many ifcase. This patch split it for removing an if. Signed-off-by: Corentin Labbe Acked-by: Giuseppe Cavallaro Reviewed-by: Giuseppe Cavallaro Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index bebe81010644..3cbe09682afe 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -721,15 +721,19 @@ static void stmmac_adjust_link(struct net_device *dev) ctrl &= ~priv->hw->link.port; break; case 100: + if (priv->plat->has_gmac || + priv->plat->has_gmac4) { + ctrl |= priv->hw->link.port; + ctrl |= priv->hw->link.speed; + } else { + ctrl &= ~priv->hw->link.port; + } + break; case 10: if (priv->plat->has_gmac || priv->plat->has_gmac4) { ctrl |= priv->hw->link.port; - if (phydev->speed == SPEED_100) { - ctrl |= priv->hw->link.speed; - } else { - ctrl &= ~(priv->hw->link.speed); - } + ctrl &= ~(priv->hw->link.speed); } else { ctrl &= ~priv->hw->link.port; }