net: phy: split locked and unlocked section of phy_state_machine()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 14 Sep 2023 15:35:57 +0000 (16:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Sep 2023 13:31:23 +0000 (14:31 +0100)
commit8635c0663e6bd8b4a11c0cf33d3b067db67ea819
treeea1f6f0562a837ec9223d4397d03f3a916548d08
parentc398ef41b6d48bd204260b136b4517e0f130892a
net: phy: split locked and unlocked section of phy_state_machine()

Split out the locked and unlocked sections of phy_state_machine() into
two separate functions which can be called inside the phydev lock and
outside the phydev lock as appropriate, thus allowing us to combine
the locked regions in the caller of phy_state_machine() with the
locked region inside phy_state_machine().

This avoids unnecessarily dropping the phydev lock which may allow
races to occur.

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>
drivers/net/phy/phy.c