summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2019-02-11 22:16:13 +0100
committerDavid S. Miller <davem@davemloft.net>2019-02-12 12:40:36 -0500
commit9f771f1f52f26acd61479eb1919801cbbfab3a57 (patch)
tree4cf227e1ab7cfc54ffd9d5d4325f549b9cebe9fa /drivers/net/phy/phy_device.c
parentc0ab4732d4c658f74eb929d3f615d390f03d660c (diff)
downloadlinux-9f771f1f52f26acd61479eb1919801cbbfab3a57.tar.bz2
net: phy: simplify genphy_config_eee_advert
Use new function phy_modify_mmd_changed(), the result speaks for itself. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 3d14e48aebc5..2c61282a2726 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1578,31 +1578,16 @@ static int genphy_config_advert(struct phy_device *phydev)
*/
static int genphy_config_eee_advert(struct phy_device *phydev)
{
- int broken = phydev->eee_broken_modes;
- int old_adv, adv;
+ int err;
/* Nothing to disable */
- if (!broken)
+ if (!phydev->eee_broken_modes)
return 0;
- /* If the following call fails, we assume that EEE is not
- * supported by the phy. If we read 0, EEE is not advertised
- * In both case, we don't need to continue
- */
- adv = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV);
- if (adv <= 0)
- return 0;
-
- old_adv = adv;
- adv &= ~broken;
-
- /* Advertising remains unchanged with the broken mask */
- if (old_adv == adv)
- return 0;
-
- phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, adv);
-
- return 1;
+ err = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV,
+ phydev->eee_broken_modes, 0);
+ /* If the call failed, we assume that EEE is not supported */
+ return err < 0 ? 0 : err;
}
/**