Skip to content

Commit c9dabd1

Browse files
xiaoleiwang123456gregkh
authored andcommitted
net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
[ Upstream commit 6dbe852 ] For some MAC drivers, they set the mac_managed_pm to true in its ->ndo_open() callback. So before the mac_managed_pm is set to true, we still want to leverage the mdio_bus_phy_suspend()/resume() for the phy device suspend and resume. In this case, the phy device is in PHY_READY, and we shouldn't warn about this. It also seems that the check of mac_managed_pm in WARN_ON is redundant since we already check this in the entry of mdio_bus_phy_resume(), so drop it. Fixes: 744d23c ("net: phy: Warn about incorrect mdio_bus_phy_resume() state") Signed-off-by: Xiaolei Wang <[email protected]> Acked-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent c4b3847 commit c9dabd1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/phy/phy_device.c

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

316316
phydev->suspended_by_mdio_bus = 0;
317317

318-
/* If we managed to get here with the PHY state machine in a state other
319-
* than PHY_HALTED this is an indication that something went wrong and
320-
* we should most likely be using MAC managed PM and we are not.
318+
/* If we manged to get here with the PHY state machine in a state neither
319+
* PHY_HALTED nor PHY_READY this is an indication that something went wrong
320+
* and we should most likely be using MAC managed PM and we are not.
321321
*/
322-
WARN_ON(phydev->state != PHY_HALTED && !phydev->mac_managed_pm);
322+
WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY);
323323

324324
ret = phy_init_hw(phydev);
325325
if (ret < 0)

0 commit comments

Comments
 (0)