netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: avoid config_init failure on unattached PHY during resume
@ 2025-09-10  2:58 yicongsrfy
  2025-09-10  8:15 ` Russell King (Oracle)
  0 siblings, 1 reply; 13+ messages in thread
From: yicongsrfy @ 2025-09-10  2:58 UTC (permalink / raw)
  To: andrew, hkallweit1, linux
  Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel, yicong

From: Yi Cong <yicong@kylinos.cn>

When resuming a PHY device that is not attached to a MAC (i.e.
phydev->attached_dev is NULL), mdio_bus_phy_resume() may call into
phy_init_hw() -> phydev->drv->config_init(), which can return -EOPNOTSUPP
(-95) if the driver does not support initialization in this state.

This results in log messages like:
[ 1905.106209] YT8531S Gigabit Ethernet xxxxmac_mii_bus-XXXX:00:01:
PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0x180 [libphy] returns -95
[ 1905.106232] YT8531S Gigabit Ethernet xxxxmac_mii_bus-XXXX:00:01:
PM: failed to resume: error -95

In practice, only one PHY on the bus (e.g. XXXX:00:00) is typically
attached to a MAC interface; others (like XXXX:00:01) are probed but
not used, making such resume attempts unnecessary and misleading.

Add an early return in mdio_bus_phy_resume() when !phydev->attached_dev,
to prevent unneeded hardware initialization and avoids false error reports.

Fixes: 611d779af7ca ("net: phy: fix MDIO bus PM PHY resuming")
Signed-off-by: Yi Cong <yicong@kylinos.cn>
---
 drivers/net/phy/phy_device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 7556aa3dd7ee..e8b4be967832 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -373,6 +373,9 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
 	struct phy_device *phydev = to_phy_device(dev);
 	int ret;
 
+	if (!phydev->attached_dev)
+		return 0;
+
 	if (phydev->mac_managed_pm)
 		return 0;
 
-- 
2.25.1


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

end of thread, other threads:[~2025-09-22  1:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-10  2:58 [PATCH] net: phy: avoid config_init failure on unattached PHY during resume yicongsrfy
2025-09-10  8:15 ` Russell King (Oracle)
2025-09-10  9:17   ` yicongsrfy
2025-09-10  9:31     ` yicongsrfy
2025-09-10  9:57       ` Russell King (Oracle)
2025-09-10  9:54     ` Russell King (Oracle)
2025-09-11 11:25       ` yicongsrfy
2025-09-11 12:58         ` Andrew Lunn
2025-09-17  8:24           ` yicongsrfy
2025-09-17 10:06         ` Russell King (Oracle)
2025-09-19  7:38           ` yicongsrfy
2025-09-19 12:45             ` Andrew Lunn
2025-09-22  1:56               ` yicongsrfy

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).