@@ -5570,17 +5570,16 @@ static void iwl_mvm_csa_block_txqs(void *data, struct ieee80211_sta *sta)
55705570}
55715571
55725572#define IWL_MAX_CSA_BLOCK_TX 1500
5573- int iwl_mvm_pre_channel_switch (struct ieee80211_hw * hw ,
5573+ int iwl_mvm_pre_channel_switch (struct iwl_mvm * mvm ,
55745574 struct ieee80211_vif * vif ,
55755575 struct ieee80211_channel_switch * chsw )
55765576{
5577- struct iwl_mvm * mvm = IWL_MAC80211_GET_MVM (hw );
55785577 struct ieee80211_vif * csa_vif ;
55795578 struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
55805579 struct iwl_mvm_txq * mvmtxq ;
55815580 int ret ;
55825581
5583- mutex_lock (& mvm -> mutex );
5582+ lockdep_assert_held (& mvm -> mutex );
55845583
55855584 mvmvif -> csa_failed = false;
55865585 mvmvif -> csa_blocks_tx = false;
@@ -5598,25 +5597,19 @@ int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
55985597 rcu_dereference_protected (mvm -> csa_vif ,
55995598 lockdep_is_held (& mvm -> mutex ));
56005599 if (WARN_ONCE (csa_vif && csa_vif -> bss_conf .csa_active ,
5601- "Another CSA is already in progress" )) {
5602- ret = - EBUSY ;
5603- goto out_unlock ;
5604- }
5600+ "Another CSA is already in progress" ))
5601+ return - EBUSY ;
56055602
56065603 /* we still didn't unblock tx. prevent new CS meanwhile */
56075604 if (rcu_dereference_protected (mvm -> csa_tx_blocked_vif ,
5608- lockdep_is_held (& mvm -> mutex ))) {
5609- ret = - EBUSY ;
5610- goto out_unlock ;
5611- }
5605+ lockdep_is_held (& mvm -> mutex )))
5606+ return - EBUSY ;
56125607
56135608 rcu_assign_pointer (mvm -> csa_vif , vif );
56145609
56155610 if (WARN_ONCE (mvmvif -> csa_countdown ,
5616- "Previous CSA countdown didn't complete" )) {
5617- ret = - EBUSY ;
5618- goto out_unlock ;
5619- }
5611+ "Previous CSA countdown didn't complete" ))
5612+ return - EBUSY ;
56205613
56215614 mvmvif -> csa_target_freq = chsw -> chandef .chan -> center_freq ;
56225615
@@ -5650,10 +5643,8 @@ int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
56505643 * we don't know the dtim period. In this case, the firmware can't
56515644 * track the beacons.
56525645 */
5653- if (!vif -> cfg .assoc || !vif -> bss_conf .dtim_period ) {
5654- ret = - EBUSY ;
5655- goto out_unlock ;
5656- }
5646+ if (!vif -> cfg .assoc || !vif -> bss_conf .dtim_period )
5647+ return - EBUSY ;
56575648
56585649 if (chsw -> delay > IWL_MAX_CSA_BLOCK_TX &&
56595650 hweight16 (vif -> valid_links ) <= 1 )
@@ -5675,7 +5666,7 @@ int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
56755666 IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD )) {
56765667 ret = iwl_mvm_old_pre_chan_sw_sta (mvm , vif , chsw );
56775668 if (ret )
5678- goto out_unlock ;
5669+ return ret ;
56795670 } else {
56805671 iwl_mvm_schedule_client_csa (mvm , vif , chsw );
56815672 }
@@ -5691,12 +5682,23 @@ int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
56915682
56925683 ret = iwl_mvm_power_update_ps (mvm );
56935684 if (ret )
5694- goto out_unlock ;
5685+ return ret ;
56955686
56965687 /* we won't be on this channel any longer */
56975688 iwl_mvm_teardown_tdls_peers (mvm );
56985689
5699- out_unlock :
5690+ return ret ;
5691+ }
5692+
5693+ static int iwl_mvm_mac_pre_channel_switch (struct ieee80211_hw * hw ,
5694+ struct ieee80211_vif * vif ,
5695+ struct ieee80211_channel_switch * chsw )
5696+ {
5697+ struct iwl_mvm * mvm = IWL_MAC80211_GET_MVM (hw );
5698+ int ret ;
5699+
5700+ mutex_lock (& mvm -> mutex );
5701+ ret = iwl_mvm_pre_channel_switch (mvm , vif , chsw );
57005702 mutex_unlock (& mvm -> mutex );
57015703
57025704 return ret ;
@@ -6482,7 +6484,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = {
64826484 .set_tim = iwl_mvm_set_tim ,
64836485
64846486 .channel_switch = iwl_mvm_channel_switch ,
6485- .pre_channel_switch = iwl_mvm_pre_channel_switch ,
6487+ .pre_channel_switch = iwl_mvm_mac_pre_channel_switch ,
64866488 .post_channel_switch = iwl_mvm_post_channel_switch ,
64876489 .abort_channel_switch = iwl_mvm_abort_channel_switch ,
64886490 .channel_switch_rx_beacon = iwl_mvm_channel_switch_rx_beacon ,
0 commit comments