Skip to content

Commit

Permalink
net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Xiaolei Wang authored and kuba-moo committed Aug 23, 2022
1 parent b8d4380 commit 6dbe852
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)

phydev->suspended_by_mdio_bus = 0;

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

ret = phy_init_hw(phydev);
if (ret < 0)
Expand Down

0 comments on commit 6dbe852

Please sign in to comment.