Skip to content

Commit ea64cdf

Browse files
l1kPaolo Abeni
authored andcommitted
net: phy: Don't WARN for PHY_UP state in mdio_bus_phy_resume()
Commit 744d23c ("net: phy: Warn about incorrect mdio_bus_phy_resume() state") introduced a WARN() on resume from system sleep if a PHY is not in PHY_HALTED state. Commit 6dbe852 ("net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()") added an exemption for PHY_READY state from the WARN(). It turns out PHY_UP state needs to be exempted as well because the following may happen on suspend: mdio_bus_phy_suspend() phy_stop_machine() phydev->state = PHY_UP # if (phydev->state >= PHY_UP) Fixes: 744d23c ("net: phy: Warn about incorrect mdio_bus_phy_resume() state") Reported-by: Marek Szyprowski <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/netdev/[email protected]/ Signed-off-by: Lukas Wunner <[email protected]> Acked-by: Florian Fainelli <[email protected]> Cc: Xiaolei Wang <[email protected]> Link: https://lore.kernel.org/r/8128fdb51eeebc9efbf3776a4097363a1317aaf1.1663905575.git.lukas@wunner.de Signed-off-by: Paolo Abeni <[email protected]>
1 parent 49725ff commit ea64cdf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/net/phy/phy_device.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,13 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
316316

317317
phydev->suspended_by_mdio_bus = 0;
318318

319-
/* If we manged to get here with the PHY state machine in a state neither
320-
* PHY_HALTED nor PHY_READY this is an indication that something went wrong
321-
* and we should most likely be using MAC managed PM and we are not.
319+
/* If we managed to get here with the PHY state machine in a state
320+
* neither PHY_HALTED, PHY_READY nor PHY_UP, this is an indication
321+
* that something went wrong and we should most likely be using
322+
* MAC managed PM, but we are not.
322323
*/
323-
WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY);
324+
WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY &&
325+
phydev->state != PHY_UP);
324326

325327
ret = phy_init_hw(phydev);
326328
if (ret < 0)

0 commit comments

Comments
 (0)