net: phy: Immediately call adjust_link if only tx_lpi_enabled changes
[linux-2.6-microblaze.git] / drivers / net / phy / phy-c45.c
index 3e95b8a..5695935 100644 (file)
@@ -1550,6 +1550,8 @@ EXPORT_SYMBOL(genphy_c45_ethtool_get_eee);
  * advertised, but the previously advertised link modes are
  * retained. This allows EEE to be enabled/disabled in a
  * non-destructive way.
+ * Returns either error code, 0 if there was no change, or positive
+ * value if there was a change which triggered auto-neg.
  */
 int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
                               struct ethtool_keee *data)
@@ -1576,8 +1578,16 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
        phydev->eee_enabled = data->eee_enabled;
 
        ret = genphy_c45_an_config_eee_aneg(phydev);
-       if (ret > 0)
-               return phy_restart_aneg(phydev);
+       if (ret > 0) {
+               ret = phy_restart_aneg(phydev);
+               if (ret < 0)
+                       return ret;
+
+               /* explicitly return 1, otherwise (ret > 0) value will be
+                * overwritten by phy_restart_aneg().
+                */
+               return 1;
+       }
 
        return ret;
 }