diff options
author | LABBE Corentin <clabbe.montjoie@gmail.com> | 2017-02-15 10:46:43 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-15 13:20:55 -0500 |
commit | 9beae261baab3f5a3001933cbc4d321538bef344 (patch) | |
tree | 49d62faabe8d9a21a963d0ccadba049dc5ea41e2 /drivers | |
parent | 5db1355673205dccaf754dc3cb2f6b5abc2ff67e (diff) |
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 <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 |
1 files changed, 9 insertions, 5 deletions
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; } |