[1/2,SRU,Xenial] net: phylib: fix interrupts re-enablement in phy_start

Message ID 20180807192126.9965-2-dann.frazier@canonical.com
State New
Headers show
Series
  • Fix link recovery on APM Merlin boards
Related show

Commit Message

dann frazier Aug. 7, 2018, 7:21 p.m.
From: Shaohui Xie <Shaohui.Xie@nxp.com>

BugLink: https://bugs.launchpad.net/bugs/1785739

If phy was suspended and is starting, current driver always enable
phy's interrupts, if phy works in polling, phy can raise unexpected
interrupt which will not be handled, the interrupt will block system
enter suspend again. So interrupts should only be re-enabled if phy
works in interrupt.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 84a527a41f38a80353f185d05e41b021e1ff672b)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
---
 drivers/net/phy/phy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7d2cf015c5e76..6db20e2d1e1af 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -793,9 +793,11 @@  void phy_start(struct phy_device *phydev)
 		break;
 	case PHY_HALTED:
 		/* make sure interrupts are re-enabled for the PHY */
-		err = phy_enable_interrupts(phydev);
-		if (err < 0)
-			break;
+		if (phydev->irq != PHY_POLL) {
+			err = phy_enable_interrupts(phydev);
+			if (err < 0)
+				break;
+		}
 
 		phydev->state = PHY_RESUMING;
 		do_resume = true;