Message ID | 20221201175302.2732938-1-l.stach@pengutronix.de (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: phylink: don't try to stop halted PHY | expand |
On Thu, Dec 01, 2022 at 06:53:02PM +0100, Lucas Stach wrote: > When the PHY driver has encountered a non-recoverable error condition, e.g > due to a failure in MDIO communication it may have already halted the PHY > by calling phy_error(). If that is the case then phylink should not try to > stop the PHY again. No. phylib doesn't say this is necessary, and if you grep the many network drivers, they don't do such a test. If we want to do this then obviously all network drivers need to be updated to do the same test before calling phy_stop()... but it would be better if phylib avoided being rather silly in this case.
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 6547b6cc6cbe..1e2be9197567 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1935,7 +1935,7 @@ void phylink_stop(struct phylink *pl) if (pl->sfp_bus) sfp_upstream_stop(pl->sfp_bus); - if (pl->phydev) + if (pl->phydev && phy_is_started(pl->phydev)) phy_stop(pl->phydev); del_timer_sync(&pl->link_poll); if (pl->link_irq) {
When the PHY driver has encountered a non-recoverable error condition, e.g due to a failure in MDIO communication it may have already halted the PHY by calling phy_error(). If that is the case then phylink should not try to stop the PHY again. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)