net: phylib: fix interrupts re-enablement in phy_start
authorShaohui Xie <[email protected]>
Tue, 10 May 2016 09:42:26 +0000 (17:42 +0800)
committerDavid S. Miller <[email protected]>
Tue, 10 May 2016 19:59:49 +0000 (15:59 -0400)
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 <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/phy/phy.c

index 5590b9c182c967d80a186256162f30690c707506..445fc5aef308620b277fe0aaff268dff0a3d4e41 100644 (file)
@@ -790,9 +790,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;