net: phy: make phy_suspend a no-op if PHY is suspended already

Gently handle the case that phy_suspend() is called whilst PHY is in
power-down.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Heiner Kallweit 2020-04-23 21:34:33 +02:00 committed by David S. Miller
parent 5c05c1dbb1
commit d70c47c8dc

View File

@ -1524,6 +1524,9 @@ int phy_suspend(struct phy_device *phydev)
struct phy_driver *phydrv = phydev->drv;
int ret;
if (phydev->suspended)
return 0;
/* If the device has WOL enabled, we cannot suspend the PHY */
phy_ethtool_get_wol(phydev, &wol);
if (wol.wolopts || (netdev && netdev->wol_enabled))