[PATCH net v6 0/2] net: fix a stale phylink PHY pointer and a lost PHY interrupt

Aleksei Sviridkin posted 2 patches 2 weeks, 3 days ago
There is a newer version of this series
drivers/net/phy/phy_device.c | 18 ++++++++++++++++++
drivers/net/phy/phylink.c    | 29 ++++++++++++++++++++---------
2 files changed, 38 insertions(+), 9 deletions(-)
[PATCH net v6 0/2] net: fix a stale phylink PHY pointer and a lost PHY interrupt
Posted by Aleksei Sviridkin 2 weeks, 3 days ago
Two fixes on the same path: a PHY whose driver is a module on a rootfs
that is not mounted when the MAC probes.

Patch 1 clears a stale pl->phydev when bringup fails after recording it,
so a later disconnect cannot detach the same PHY twice. Unchanged since
v3, where it got a Reviewed-by.

Patch 2 gives back the interrupt phy_probe() replaced with PHY_POLL. v5
kept the number in a new struct phy_device field. Andrew asked for
mdiobus->irq[] to be the source of truth instead, so v6 reads it from
there and the field is gone; the patch is now four lines of logic and no
new state.

That leaves buses whose driver writes only phydev->irq and never the
table. On those the table holds PHY_POLL and there is nothing to give
back, so the fix does not reach them. Three are in that position:
lan78xx and smsc95xx, which Andrew named, and sxgbe_mdio, which writes
its own irqlist and the phydev but not the bus. Converting them is their
maintainers' call and I have left them alone here rather than send a
series across four subsystems; say the word and they follow.

Measured on an MT7981B board, an MT7531 switch port with an Airoha
EN8811H whose driver is a module. The generic driver binds first, and
the number is read out either side of the detach that releases it:

  with patch 2:     bound: irq -1   after detach: irq 15
  without patch 2:  bound: irq -1   after detach: irq -1

-1 is PHY_POLL, 15 is what the device tree gives that PHY. The cycle
repeats once a second and every pass on both builds reads the same.
Reaching that state needs a kernel that lets the generic driver bind
where this board would normally refuse it, so both numbers come from a
modified poller; the patch under test is the only difference between the
two builds.

Previous posting:
https://lore.kernel.org/netdev/20260906174643.4107607-1-f@lex.la/

Aleksei Sviridkin (2):
  net: phylink: unwind the PHY binding when bringup fails late
  net: phy: restore the interrupt the bus gave a PHY

 drivers/net/phy/phy_device.c | 18 ++++++++++++++++++
 drivers/net/phy/phylink.c    | 29 ++++++++++++++++++++---------
 2 files changed, 38 insertions(+), 9 deletions(-)


base-commit: 38b6be101006d3e7af972999f45d4f1e8250587a
-- 
2.53.0