Re: [PATCH] net: phy: fix may not suspend when phy has WoL

From: Russell King (Oracle)
Date: Mon Nov 11 2024 - 05:05:52 EST


On Mon, Nov 11, 2024 at 04:06:27PM +0800, WangYuli wrote:
> From: Wentao Guan <guanwentao@xxxxxxxxxxxxx>
>
> When system suspends and mdio_bus_phy goes to suspend, if the phy
> enabled wol, phy_suspend will returned -EBUSY, and break system
> suspend.
>
> Commit 93f41e67dc8f ("net: phy: fix WoL handling when suspending
> the PHY") fixes the case when netdev->wol_enabled=1, but some case,
> netdev->wol_enabled=0 and phydev set wol_enabled enabled, so check
> phydev->wol_enabled.

I think a better question would be... why do we propagate the -EBUSY
error code from phy_suspend() in mdio_bus_phy_suspend() ? It returns
-EBUSY "If the device has WOL enabled, we cannot suspend the PHY" so
it seems ignoring this error code would avoid adding yet more
complexity, trying to match the conditions in mdio_bus_phy_may_suspend()
with those in phy_suspend().

In any case, there's a helper for reading the WoL state.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!