summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFugang Duan <b38611@freescale.com>2015-06-05 15:16:23 +0800
committerFugang Duan <b38611@freescale.com>2016-02-19 14:11:45 +0800
commit0d406ab67926155489c0cce71db365a2770ab097 (patch)
tree4175d3e3729392647339b05e427610c397da61a7 /drivers
parent957cf16b11237ac286b655b65b4eeadd08bbcfbc (diff)
MLK-11051 net: phy: mdio_bus: don't call .phy_suspendi() when netdev is NULL
In .mdio_bus_phy_may_suspend(), there check netdev is NULL to judge to set phy to suspend status. 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. In i.MX6UL evk/arm2 board, if down the ethx interface and do suspend/resume, system will hang. Because after ethx down all clocks are gated off, for general phy driver, unbind the phy device, for specifical phy driver, no unbind the device, and the original driver call mdio bus to set phy to suspend during system suspend, so system will hang since there have mdio register access. The patch can fix it. Signed-off-by: Fugang Duan <B38611@freescale.com> (cherry picked and merged from commit: ccbbf6172860e310858169a4e551ebf072c2f1a5) Conflicts: drivers/net/phy/mdio_bus.c
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/mdio_bus.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 095ef3fe369a..e695bef928c8 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -443,13 +443,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)
- return !phydev->suspended;
+ return false;
/* Don't suspend PHY if the attched netdev parent may wakeup.
* The parent may point to a PCI device, as in tg3 driver.