Commit d47e5a43 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

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: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 418c1214
...@@ -2601,6 +2601,7 @@ static void sfp_check_state(struct sfp *sfp) ...@@ -2601,6 +2601,7 @@ static void sfp_check_state(struct sfp *sfp)
unsigned int state, i, changed; unsigned int state, i, changed;
mutex_lock(&sfp->st_mutex); mutex_lock(&sfp->st_mutex);
rtnl_lock();
state = sfp_get_state(sfp); state = sfp_get_state(sfp);
changed = state ^ sfp->state; changed = state ^ sfp->state;
if (sfp->tx_fault_ignore) if (sfp->tx_fault_ignore)
...@@ -2616,7 +2617,6 @@ static void sfp_check_state(struct sfp *sfp) ...@@ -2616,7 +2617,6 @@ static void sfp_check_state(struct sfp *sfp)
state |= sfp->state & (SFP_F_TX_DISABLE | SFP_F_RATE_SELECT); state |= sfp->state & (SFP_F_TX_DISABLE | SFP_F_RATE_SELECT);
sfp->state = state; sfp->state = state;
rtnl_lock();
if (changed & SFP_F_PRESENT) if (changed & SFP_F_PRESENT)
sfp_sm_event(sfp, state & SFP_F_PRESENT ? sfp_sm_event(sfp, state & SFP_F_PRESENT ?
SFP_E_INSERT : SFP_E_REMOVE); SFP_E_INSERT : SFP_E_REMOVE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment