net: phy: ensure phylib state machine is stopped after calling phy_stop
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 17 Jan 2019 19:08:39 +0000 (20:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jan 2019 22:12:25 +0000 (14:12 -0800)
The call to the phylib state machine in phy_stop() just ensures that
the state machine isn't re-triggered, but a state machine call may
be scheduled already. So lets's call phy_stop_machine().
This also allows to get rid of the call to phy_stop_machine() in
phy_disconnect().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c

index b0632e859564b5907316a25be2169261a60d04b9..37cf39fdcc91fe9bccea200a80754aa0c44b3e57 100644 (file)
@@ -858,6 +858,7 @@ void phy_stop(struct phy_device *phydev)
        mutex_unlock(&phydev->lock);
 
        phy_state_machine(&phydev->state_queue.work);
+       phy_stop_machine(phydev);
 
        /* Cannot call flush_scheduled_work() here as desired because
         * of rtnl_lock(), but PHY_HALTED shall guarantee irq handler
index 616a5fe47f56933e83911c0f12cf39e5945beaaf..e269a355012db336e5030357f2f9c5471071f204 100644 (file)
@@ -1005,8 +1005,6 @@ void phy_disconnect(struct phy_device *phydev)
        if (phydev->irq > 0)
                phy_stop_interrupts(phydev);
 
-       phy_stop_machine(phydev);
-
        phydev->adjust_link = NULL;
 
        phy_detach(phydev);