[PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()

Subsystems: ethernet phy library, networking drivers, the rest

STALE1445d

2 messages, 2 authors, 2022-08-19 · open the first message on its own page

[PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()

From: Xiaolei Wang <hidden>
Date: 2022-08-18 07:30:45

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: fba863b81604 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
Signed-off-by: Xiaolei Wang <redacted>
---
 drivers/net/phy/phy_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0c6efd792690..12ff276b80ae 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -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)
-- 
2.25.1

Re: [PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()

From: Jakub Kicinski <kuba@kernel.org>
Date: 2022-08-19 04:12:18

On Thu, 18 Aug 2022 15:29:43 +0800 Xiaolei Wang wrote:
Fixes: fba863b81604 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
I think the hash is wrong here. Please fix and repost (make sure to CC
the right folks once you change the hash).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help