Skip to content

Commit a8f1b40

Browse files
ffainelligregkh
authored andcommitted
net: phy: Correctly process PHY_HALTED in phy_stop_machine()
[ Upstream commit 7ad813f208533cebfcc32d3d7474dc1677d1b09a ] Marc reported that he was not getting the PHY library adjust_link() callback function to run when calling phy_stop() + phy_disconnect() which does not indeed happen because we set the state machine to PHY_HALTED but we don't get to run it to process this state past that point. Fix this with a synchronous call to phy_state_machine() in order to have the state machine actually act on PHY_HALTED, set the PHY device's link down, turn the network device's carrier off and finally call the adjust_link() function. Reported-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com> Fixes: a390d1f ("phylib: convert state_queue work to delayed_work") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dc41327 commit a8f1b40

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/phy/phy.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,9 @@ void phy_stop_machine(struct phy_device *phydev)
541541
if (phydev->state > PHY_UP && phydev->state != PHY_HALTED)
542542
phydev->state = PHY_UP;
543543
mutex_unlock(&phydev->lock);
544+
545+
/* Now we can run the state machine synchronously */
546+
phy_state_machine(&phydev->state_queue.work);
544547
}
545548

546549
/**

0 commit comments

Comments
 (0)