Skip to content

Commit

Permalink
net: phy: move call to start aneg
Browse files Browse the repository at this point in the history
Move the call to start auto-negotiation inside the lock in the PHYLIB
state machine, calling the locked variant _phy_start_aneg(). This
avoids unnecessarily releasing and re-acquiring the lock.

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 ef113a6 commit ea5968c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,14 +1489,15 @@ void phy_state_machine(struct work_struct *work)
break;
}

if (needs_aneg) {
err = _phy_start_aneg(phydev);
func = &_phy_start_aneg;
}

mutex_unlock(&phydev->lock);

if (needs_aneg) {
err = phy_start_aneg(phydev);
func = &phy_start_aneg;
} else if (do_suspend) {
if (do_suspend)
phy_suspend(phydev);
}

if (err == -ENODEV)
return;
Expand Down

0 comments on commit ea5968c

Please sign in to comment.