From: Heiner Kallweit Date: Thu, 15 Aug 2019 11:15:19 +0000 (+0200) Subject: net: phy: read MII_CTRL1000 in genphy_read_status only if needed X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=916e571ebad37b820a2a4465dc2ea7643f2007fc;p=openwrt%2Fstaging%2Fblogic.git net: phy: read MII_CTRL1000 in genphy_read_status only if needed Value of MII_CTRL1000 is needed only if LPA_1000MSFAIL is set. Therefore move reading this register. Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b039632de73a..9c546bae9ec9 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1784,7 +1784,7 @@ EXPORT_SYMBOL(genphy_update_link); */ int genphy_read_status(struct phy_device *phydev) { - int adv, lpa, lpagb, err, old_link = phydev->link; + int lpa, lpagb, err, old_link = phydev->link; /* Update the link, but return if there was an error */ err = genphy_update_link(phydev); @@ -1806,11 +1806,12 @@ int genphy_read_status(struct phy_device *phydev) if (lpagb < 0) return lpagb; - adv = phy_read(phydev, MII_CTRL1000); - if (adv < 0) - return adv; - if (lpagb & LPA_1000MSFAIL) { + int adv = phy_read(phydev, MII_CTRL1000); + + if (adv < 0) + return adv; + if (adv & CTL1000_ENABLE_MASTER) phydev_err(phydev, "Master/Slave resolution failed, maybe conflicting manual settings?\n"); else