summaryrefslogtreecommitdiff
path: root/drivers/net/phy/sfp.c
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-05-17 11:37:52 +0100
committerJakub Kicinski <kuba@kernel.org>2023-05-18 19:52:31 -0700
commitd47e5a430dfd8b15739a118e4a2add5fa90347fd (patch)
treed023fbf5ac98d879d5c4565a0cd092c7bb9a66a9 /drivers/net/phy/sfp.c
parent418c1214741cf3ac5e420382a85c4f8a40586024 (diff)
net: sfp: move rtnl lock to cover reading state
As preparation to moving st_mutex inside rtnl_lock, we need to first move the rtnl lock to cover reading the state. Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/sfp.c')
-rw-r--r--drivers/net/phy/sfp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index c97a87393fdb..3fc703e4dd21 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2601,6 +2601,7 @@ static void sfp_check_state(struct sfp *sfp)
unsigned int state, i, changed;
mutex_lock(&sfp->st_mutex);
+ rtnl_lock();
state = sfp_get_state(sfp);
changed = state ^ sfp->state;
if (sfp->tx_fault_ignore)
@@ -2616,7 +2617,6 @@ static void sfp_check_state(struct sfp *sfp)
state |= sfp->state & (SFP_F_TX_DISABLE | SFP_F_RATE_SELECT);
sfp->state = state;
- rtnl_lock();
if (changed & SFP_F_PRESENT)
sfp_sm_event(sfp, state & SFP_F_PRESENT ?
SFP_E_INSERT : SFP_E_REMOVE);