netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v2][PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
@ 2022-08-19  8:24 Xiaolei Wang
  2022-08-20  2:57 ` Florian Fainelli
  2022-08-23  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaolei Wang @ 2022-08-19  8:24 UTC (permalink / raw)
  To: andrew, hkallweit1
  Cc: f.fainelli, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

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: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [v2][PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
  2022-08-19  8:24 [v2][PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume() Xiaolei Wang
@ 2022-08-20  2:57 ` Florian Fainelli
  2022-08-23  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2022-08-20  2:57 UTC (permalink / raw)
  To: Xiaolei Wang, andrew, hkallweit1
  Cc: linux, davem, edumazet, kuba, pabeni, netdev, linux-kernel



On 8/19/2022 1:24 AM, Xiaolei Wang wrote:
> 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: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

I see the use case you have and it does make sense to me, thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [v2][PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
  2022-08-19  8:24 [v2][PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume() Xiaolei Wang
  2022-08-20  2:57 ` Florian Fainelli
@ 2022-08-23  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-23  1:30 UTC (permalink / raw)
  To: Xiaolei Wang
  Cc: andrew, hkallweit1, f.fainelli, linux, davem, edumazet, kuba,
	pabeni, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 19 Aug 2022 16:24:51 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v2] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
    https://git.kernel.org/netdev/net/c/6dbe852c379f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-23  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19  8:24 [v2][PATCH] net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume() Xiaolei Wang
2022-08-20  2:57 ` Florian Fainelli
2022-08-23  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).