diff options
author | 2019-02-14 12:04:55 -0500 | |
---|---|---|
committer | 2019-02-14 12:04:55 -0500 | |
commit | 61c4c0bcff87773cd65d1cf487e2b2a34bc6730f (patch) | |
tree | 5c4576e502af6717242dee142475bf318856d0cc /include | |
parent | selftests: fix timestamping Makefile (diff) | |
parent | net: phy: fix potential race in the phylib state machine (diff) | |
download | wireguard-linux-61c4c0bcff87773cd65d1cf487e2b2a34bc6730f.tar.xz wireguard-linux-61c4c0bcff87773cd65d1cf487e2b2a34bc6730f.zip |
Merge branch 'net-phy-fix-locking-issue'
Heiner Kallweit says:
====================
net: phy: fix locking issue
Russell pointed out that the locking used in phy_is_started() isn't
needed and misleading. This locking also contributes to a race fixed
with patch 2.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/phy.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index ef20aeea10cc..127fcc9c3778 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -674,26 +674,13 @@ phy_lookup_setting(int speed, int duplex, const unsigned long *mask, size_t phy_speeds(unsigned int *speeds, size_t size, unsigned long *mask); -static inline bool __phy_is_started(struct phy_device *phydev) -{ - WARN_ON(!mutex_is_locked(&phydev->lock)); - - return phydev->state >= PHY_UP; -} - /** * phy_is_started - Convenience function to check whether PHY is started * @phydev: The phy_device struct */ static inline bool phy_is_started(struct phy_device *phydev) { - bool started; - - mutex_lock(&phydev->lock); - started = __phy_is_started(phydev); - mutex_unlock(&phydev->lock); - - return started; + return phydev->state >= PHY_UP; } void phy_resolve_aneg_linkmode(struct phy_device *phydev); |