Skip to content

Commit

Permalink
net: phy: convert phy_stop() to use split state machine
Browse files Browse the repository at this point in the history
Convert phy_stop() to use the new locked-section and unlocked-section
parts of the PHY state machine.

Tested-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Russell King (Oracle) authored and David S. Miller committed Sep 17, 2023
1 parent 8635c06 commit adcbb85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@ void phy_state_machine(struct work_struct *work)
void phy_stop(struct phy_device *phydev)
{
struct net_device *dev = phydev->attached_dev;
enum phy_state_work state_work;
enum phy_state old_state;

if (!phy_is_started(phydev) && phydev->state != PHY_DOWN &&
Expand All @@ -1490,9 +1491,10 @@ void phy_stop(struct phy_device *phydev)
phydev->state = PHY_HALTED;
phy_process_state_change(phydev, old_state);

state_work = _phy_state_machine(phydev);
mutex_unlock(&phydev->lock);

phy_state_machine(&phydev->state_queue.work);
_phy_state_machine_post_work(phydev, state_work);
phy_stop_machine(phydev);

/* Cannot call flush_scheduled_work() here as desired because
Expand Down

0 comments on commit adcbb85

Please sign in to comment.