Re: [PATCH net v2] net: usb: lan78xx: let unregister_netdev() stop phylink

From: YuanZhe Liu

Date: Sun Nov 01 2026 - 01:27:12 EST


Hi Andrew,

Yes, I did, but it ended up at the bottom of my reply to the sashiko-bot
review, which was not the right place for it. Here it is directly.

e110bc825897 is the commit that introduced the call which warns. Before
it, lan78xx_disconnect() did:

unregister_netdev(net);
...
phydev = net->phydev;
phy_disconnect(net->phydev);

and phy_stop() only existed in lan78xx_stop(), guarded by
"if (net->phydev)". So disconnect never called phy_stop() on a PHY that
had not been started, and the warning was not reachable from this path.

e110bc825897 converted the driver to phylink: it moved
unregister_netdev() after the phylink teardown and added an
unconditional phylink_stop() before phylink_disconnect_phy(). Since
phylink_stop() reaches phy_stop(), which warns unless the PHY is at
least PHY_UP, unplugging before ifup started producing "called from
state READY".

git log -S'phylink_stop(dev->phylink)' -- drivers/net/usb/lan78xx.c

returns e110bc825897 and nothing else apart from my own change, so that
line has not been touched since it was added.

This is also why v2 puts unregister_netdev() back in front: it restores
the pre-conversion ordering, so an interface that was never started is
not stopped at all, and a running one is stopped by lan78xx_stop().

Thanks,
YuanZhe