[PATCH net-next v3 5/5] net: phy: Move phy_init_hw() from phy_resume() to __phy_resume()

From: Biju

Date: Sun Apr 12 2026 - 10:01:12 EST


From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Now that redundant locking has been removed from PHY driver callbacks,
phy_init_hw() can be called with phydev->lock held.

Many MAC drivers and the phylink framework resume the PHY via
phy_start(), which invokes __phy_resume() directly without going
through phy_resume(). Keeping phy_init_hw() in phy_resume() means it
is not called in this path.

Move phy_init_hw() into __phy_resume() so that PHY soft reset and
re-initialisation happen unconditionally on every resume, regardless
of which code path triggers it.

Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
---
v3:
* New patch.
---
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 4a2b19d39373..16fc2fc63c50 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1999,6 +1999,10 @@ int __phy_resume(struct phy_device *phydev)

lockdep_assert_held(&phydev->lock);

+ ret = phy_init_hw(phydev);
+ if (ret)
+ return ret;
+
if (!phydrv || !phydrv->resume)
return 0;

@@ -2014,10 +2018,6 @@ int phy_resume(struct phy_device *phydev)
{
int ret;

- ret = phy_init_hw(phydev);
- if (ret)
- return ret;
-
mutex_lock(&phydev->lock);
ret = __phy_resume(phydev);
mutex_unlock(&phydev->lock);
--
2.43.0