net: stmmac: split the stmmac_adjust_link 10/100 case
authorLABBE Corentin <clabbe.montjoie@gmail.com>
Wed, 15 Feb 2017 09:46:43 +0000 (10:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Feb 2017 18:20:55 +0000 (13:20 -0500)
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>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index bebe810106449a8f36d812138c87a8447cb1395c..3cbe09682afe7a719be0a3b83a33215ed50adce9 100644 (file)
@@ -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;
                                }