Commit c397ab21 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: don't double-read link status register if link is up

The link status register latches link-down events. Therefore, if link
is reported as being up, there's no need for a second read.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a00536c
...@@ -148,6 +148,8 @@ int genphy_c45_read_link(struct phy_device *phydev) ...@@ -148,6 +148,8 @@ int genphy_c45_read_link(struct phy_device *phydev)
val = phy_read_mmd(phydev, devad, MDIO_STAT1); val = phy_read_mmd(phydev, devad, MDIO_STAT1);
if (val < 0) if (val < 0)
return val; return val;
else if (val & MDIO_STAT1_LSTATUS)
continue;
} }
val = phy_read_mmd(phydev, devad, MDIO_STAT1); val = phy_read_mmd(phydev, devad, MDIO_STAT1);
......
...@@ -1735,8 +1735,12 @@ int genphy_update_link(struct phy_device *phydev) ...@@ -1735,8 +1735,12 @@ int genphy_update_link(struct phy_device *phydev)
*/ */
if (!phy_polling_mode(phydev)) { if (!phy_polling_mode(phydev)) {
status = phy_read(phydev, MII_BMSR); status = phy_read(phydev, MII_BMSR);
if (status < 0) if (status < 0) {
return status; return status;
} else if (status & BMSR_LSTATUS) {
phydev->link = 1;
return 0;
}
} }
/* Read link and autonegotiation status */ /* Read link and autonegotiation status */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment