diff options
author | Heiner Kallweit | 2019-04-24 21:49:30 +0200 |
---|---|---|
committer | David S. Miller | 2019-04-28 19:48:04 -0400 |
commit | 88d6272acaaa4bfb03da0a87a8754ec431471680 (patch) | |
tree | 23903a4bcfafd0aba4a61723186a9952752a6e2e /drivers/net/phy | |
parent | c1a92c0a6c564011855eb7e3b3d9aaf86ad993f4 (diff) |
net: phy: avoid unneeded MDIO reads in genphy_read_status
Considering that in polling mode each link drop will be latched,
settings can't have changed if link was up and is up.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy_device.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f794ff3a10c2..2a2aaa5f3e74 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1739,13 +1739,17 @@ EXPORT_SYMBOL(genphy_update_link); */ int genphy_read_status(struct phy_device *phydev) { - int adv, lpa, lpagb, err; + int adv, lpa, lpagb, err, old_link = phydev->link; /* Update the link, but return if there was an error */ err = genphy_update_link(phydev); if (err) return err; + /* why bother the PHY if nothing can have changed */ + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) + return 0; + phydev->speed = SPEED_UNKNOWN; phydev->duplex = DUPLEX_UNKNOWN; phydev->pause = 0; |