]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: phy: make phy_suspend a no-op if PHY is suspended already
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 23 Apr 2020 19:34:33 +0000 (21:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Apr 2020 23:47:51 +0000 (16:47 -0700)
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>
drivers/net/phy/phy_device.c

index ac2784192472fcdeeb5df2c11ba475d2da98b0d8..206d98502b13c541cb374fe84bfa36ac0ad2f026 100644 (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))