Re: [PATCH net v4 2/2] net: phy: restore the interrupt after a generic-driver bind cycle

From: Andrew Lunn

Date: Wed Sep 02 2026 - 17:00:44 EST


On Wed, Sep 02, 2026 at 08:05:11AM +0000, Aleksei Sviridkin wrote:
> A PHY with no specific driver available at attach time gets the generic
> one, and phy_probe() sets phydev->irq to PHY_POLL because that driver
> has no interrupt callbacks. Neither end of that bind cycle puts the
> value back: phy_detach() releases the generic driver so a real one can
> bind later, and a generic probe that fails never reaches phy_detach()
> at all.
>
> The specific driver that binds afterwards therefore starts with
> irq == PHY_POLL, and the PHY is polled for the rest of the uptime with
> no warning on that path. A DSA switch that connects its user ports
> before the rootfs holding the PHY driver module is mounted hits this on
> every boot.
>
> mdiobus_alloc() fills bus->irq[] with PHY_POLL for every address, and
> the bind cycle never writes to that table, so the entry still holds
> whatever the bus registered there. Restore phydev->irq from it on both
> exits, and only where the cycle left PHY_POLL. That guard preserves an
> interrupt mode a MAC installed on the attached PHY after connect, and
> it keeps a restored interrupt number out of the
> phy_connect_direct()/phy_disconnect() asymmetry, where such a MAC would
> have the interrupt requested and never freed.
>
> Fixes: 00db8189d984 ("This patch adds a PHY Abstraction Layer to the Linux Kernel, enabling ethernet drivers to remain as ignorant as is reasonable of the connected PHY's design and operation details.")
> Signed-off-by: Aleksei Sviridkin <f@xxxxxx>

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew