In subsequent patches of this series interrupts will be disabled during
system suspend, also we will have to resume the PHY in states other than
PHY_HALTED. To prepare for this unconditionally resume and re-enable
interrupts in phy_start().

Signed-off-by: Heiner Kallweit <hkallwe...@gmail.com>
---
v2:
- no changes
---
 drivers/net/phy/phy.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 05c1e8ef..0aef35ef 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -791,10 +791,16 @@ EXPORT_SYMBOL(phy_stop);
  */
 void phy_start(struct phy_device *phydev)
 {
-       int err = 0;
+       /* if phy was suspended, bring the physical link up again */
+       phy_resume(phydev);
 
-       mutex_lock(&phydev->lock);
+       /* make sure interrupts are re-enabled for the PHY */
+       if (phy_interrupt_is_valid(phydev) && phy_enable_interrupts(phydev)) {
+               phy_error(phydev);
+               return;
+       }
 
+       mutex_lock(&phydev->lock);
        switch (phydev->state) {
        case PHY_STARTING:
                phydev->state = PHY_PENDING;
@@ -803,16 +809,6 @@ void phy_start(struct phy_device *phydev)
                phydev->state = PHY_UP;
                break;
        case PHY_HALTED:
-               /* if phy was suspended, bring the physical link up again */
-               __phy_resume(phydev);
-
-               /* make sure interrupts are re-enabled for the PHY */
-               if (phy_interrupt_is_valid(phydev)) {
-                       err = phy_enable_interrupts(phydev);
-                       if (err < 0)
-                               break;
-               }
-
                phydev->state = PHY_RESUMING;
                break;
        default:
-- 
2.16.2


Reply via email to