diff options
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 78b918dcd547..d941b8f4bad1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -240,13 +240,23 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) if (!drv || !phydrv->suspend) return false; - /* PHY not attached? May suspend if the PHY has not already been - * suspended as part of a prior call to phy_disconnect() -> - * phy_detach() -> phy_suspend() because the parent netdev might be the - * MDIO bus driver and clock gated at this point. - */ + /* netdev is NULL has three cases: + * - phy is not found + * - phy is found, match to general phy driver + * - phy is found, match to specifical phy driver + * + * Case 1: phy is not found, cannot communicate by MDIO bus. + * Case 2: phy is found: + * if phy dev driver probe/bind err, netdev is not __open__ + * status, mdio bus is unregistered. + * if phy is detached, phy had entered suspended status. + * Case 3: phy is found, phy is detached, phy had entered suspended + * status. + * + * So, in here, it shouldn't set phy to suspend by calling mdio bus. + */ if (!netdev) - goto out; + return false; if (netdev->wol_enabled) return false; @@ -266,8 +276,7 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) if (device_may_wakeup(&netdev->dev)) return false; -out: - return !phydev->suspended; + return true; } static int mdio_bus_phy_suspend(struct device *dev) |