Commit 503ba7c6 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: phy: Avoid multiple suspends

It is currently possible for a PHY device to be suspended as part of a
network device driver's suspend call while it is still being attached to
that net_device, either via phy_suspend() or implicitly via phy_stop().

Later on, when the MDIO bus controller get suspended, we would attempt
to suspend again the PHY because it is still attached to a network
device.

This is both a waste of time and creates an opportunity for improper
clock/power management bugs to creep in.

Fixes: 803dd9c7 ("net: phy: avoid suspending twice a PHY")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44343418
...@@ -247,7 +247,7 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) ...@@ -247,7 +247,7 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
* MDIO bus driver and clock gated at this point. * MDIO bus driver and clock gated at this point.
*/ */
if (!netdev) if (!netdev)
return !phydev->suspended; goto out;
if (netdev->wol_enabled) if (netdev->wol_enabled)
return false; return false;
...@@ -267,7 +267,8 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) ...@@ -267,7 +267,8 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
if (device_may_wakeup(&netdev->dev)) if (device_may_wakeup(&netdev->dev))
return false; return false;
return true; out:
return !phydev->suspended;
} }
static int mdio_bus_phy_suspend(struct device *dev) static int mdio_bus_phy_suspend(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment