]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: phy: fix WoL handling when suspending the PHY
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 24 Sep 2018 20:01:32 +0000 (22:01 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Sep 2018 03:04:11 +0000 (20:04 -0700)
commit93f41e67dc8ff0fd987120a6ef2717f21462c534
treec36973bf5980fc937c213c93f6b773068ffbc21e
parent6194114324139dc16f3251c67ed853bd6d4ae056
net: phy: fix WoL handling when suspending the PHY

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: f1e911d5d0df ("r8169: add basic phylib support")
Fixes: e8cfd9d6c772 ("net: phy: call state machine synchronously in phy_stop")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c