net: stmmac: run stmmac_hw_fix_mac_speed when speed is valid
authorLABBE Corentin <clabbe.montjoie@gmail.com>
Wed, 15 Feb 2017 09:46:42 +0000 (10:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Feb 2017 18:20:55 +0000 (13:20 -0500)
This patch mutualise a bit by running stmmac_hw_fix_mac_speed() after
the switch in case of valid speed.

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 f7664b956efff05df67b78f791377233d52c73e5..bebe810106449a8f36d812138c87a8447cb1395c 100644 (file)
@@ -719,7 +719,6 @@ static void stmmac_adjust_link(struct net_device *dev)
                                if (priv->plat->has_gmac ||
                                    priv->plat->has_gmac4)
                                        ctrl &= ~priv->hw->link.port;
-                               stmmac_hw_fix_mac_speed(priv);
                                break;
                        case 100:
                        case 10:
@@ -734,7 +733,6 @@ static void stmmac_adjust_link(struct net_device *dev)
                                } else {
                                        ctrl &= ~priv->hw->link.port;
                                }
-                               stmmac_hw_fix_mac_speed(priv);
                                break;
                        default:
                                netif_warn(priv, link, priv->dev,
@@ -742,7 +740,8 @@ static void stmmac_adjust_link(struct net_device *dev)
                                phydev->speed = SPEED_UNKNOWN;
                                break;
                        }
-
+                       if (phydev->speed != SPEED_UNKNOWN)
+                               stmmac_hw_fix_mac_speed(priv);
                        priv->speed = phydev->speed;
                }