• Heiner Kallweit's avatar
    net: phy: fix WoL handling when suspending the PHY · 93f41e67
    Heiner Kallweit authored
    Core of the problem is that phy_suspend() suspends the PHY when it
    should not because of WoL. phy_suspend() checks for WoL already, but
    this works only if the PHY driver handles WoL (what is rarely the case).
    Typically WoL is handled by the MAC driver.
    
    This patch uses new member wol_enabled of struct net_device as
    additional criteria in the check when not to suspend the PHY because
    of WoL.
    
    Last but not least change phy_detach() to call phy_suspend() before
    attached_dev is set to NULL. phy_suspend() accesses attached_dev
    when checking whether the MAC driver activated WoL.
    
    Fixes: f1e911d5 ("r8169: add basic phylib support")
    Fixes: e8cfd9d6 ("net: phy: call state machine synchronously in phy_stop")
    Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
    Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    93f41e67
phy_device.c 50.5 KB