Commit 6ac2f839 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by John W. Linville

iwlagn: priv->mutex moves to iwl_shared

Since it is used by all the layers, it needs to move to iwl_shared.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 10b15e6f
...@@ -778,7 +778,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -778,7 +778,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
u8 scan_tx_antennas = hw_params(priv).valid_tx_ant; u8 scan_tx_antennas = hw_params(priv).valid_tx_ant;
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (vif) if (vif)
ctx = iwl_rxon_ctx_from_vif(vif); ctx = iwl_rxon_ctx_from_vif(vif);
...@@ -1165,7 +1165,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -1165,7 +1165,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
{ {
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) {
IWL_ERR(priv, "flush request fail\n"); IWL_ERR(priv, "flush request fail\n");
...@@ -1175,7 +1175,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -1175,7 +1175,7 @@ void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
iwlagn_wait_tx_queue_empty(priv); iwlagn_wait_tx_queue_empty(priv);
done: done:
ieee80211_wake_queues(priv->hw); ieee80211_wake_queues(priv->hw);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
/* /*
...@@ -1372,7 +1372,7 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena) ...@@ -1372,7 +1372,7 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena)
struct iwl_rxon_context *ctx, *found_ctx = NULL; struct iwl_rxon_context *ctx, *found_ctx = NULL;
bool found_ap = false; bool found_ap = false;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* Check whether AP or GO mode is active. */ /* Check whether AP or GO mode is active. */
if (rssi_ena) { if (rssi_ena) {
...@@ -1485,7 +1485,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work) ...@@ -1485,7 +1485,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
break; break;
} }
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
/* /*
* We can not send command to firmware while scanning. When the scan * We can not send command to firmware while scanning. When the scan
...@@ -1513,7 +1513,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work) ...@@ -1513,7 +1513,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
*/ */
iwlagn_bt_coex_rssi_monitor(priv); iwlagn_bt_coex_rssi_monitor(priv);
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
/* /*
......
...@@ -132,7 +132,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv, ...@@ -132,7 +132,7 @@ static void iwlagn_update_qos(struct iwl_priv *priv,
static int iwlagn_update_beacon(struct iwl_priv *priv, static int iwlagn_update_beacon(struct iwl_priv *priv,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
dev_kfree_skb(priv->beacon_skb); dev_kfree_skb(priv->beacon_skb);
priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif); priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif);
...@@ -316,7 +316,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv) ...@@ -316,7 +316,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS]; ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN]; ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
...@@ -421,7 +421,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -421,7 +421,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return -EINVAL; return -EINVAL;
...@@ -537,7 +537,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -537,7 +537,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
IWL_DEBUG_MAC80211(priv, "changed %#x", changed); IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) { if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
...@@ -652,7 +652,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -652,7 +652,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
iwlagn_commit_rxon(priv, ctx); iwlagn_commit_rxon(priv, ctx);
} }
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return ret; return ret;
} }
...@@ -667,7 +667,7 @@ static void iwlagn_check_needed_chains(struct iwl_priv *priv, ...@@ -667,7 +667,7 @@ static void iwlagn_check_needed_chains(struct iwl_priv *priv,
struct ieee80211_sta_ht_cap *ht_cap; struct ieee80211_sta_ht_cap *ht_cap;
bool need_multiple; bool need_multiple;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
switch (vif->type) { switch (vif->type) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
...@@ -792,17 +792,17 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, ...@@ -792,17 +792,17 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
int ret; int ret;
bool force = false; bool force = false;
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (unlikely(!iwl_is_ready(priv))) { if (unlikely(!iwl_is_ready(priv))) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return; return;
} }
if (unlikely(!ctx->vif)) { if (unlikely(!ctx->vif)) {
IWL_DEBUG_MAC80211(priv, "leave - vif is NULL\n"); IWL_DEBUG_MAC80211(priv, "leave - vif is NULL\n");
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return; return;
} }
...@@ -913,7 +913,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, ...@@ -913,7 +913,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
IWL_ERR(priv, "Error sending IBSS beacon\n"); IWL_ERR(priv, "Error sending IBSS beacon\n");
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
void iwlagn_post_scan(struct iwl_priv *priv) void iwlagn_post_scan(struct iwl_priv *priv)
......
...@@ -49,7 +49,7 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id) ...@@ -49,7 +49,7 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
return NULL; return NULL;
} }
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* Set up the rate scaling to start at selected rate, fall back /* Set up the rate scaling to start at selected rate, fall back
* all the way down to 1M in IEEE order, and then spin on 1M */ * all the way down to 1M in IEEE order, and then spin on 1M */
...@@ -197,7 +197,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, ...@@ -197,7 +197,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
int iwl_restore_default_wep_keys(struct iwl_priv *priv, int iwl_restore_default_wep_keys(struct iwl_priv *priv,
struct iwl_rxon_context *ctx) struct iwl_rxon_context *ctx)
{ {
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
return iwl_send_static_wepkey_cmd(priv, ctx, false); return iwl_send_static_wepkey_cmd(priv, ctx, false);
} }
...@@ -208,7 +208,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, ...@@ -208,7 +208,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
{ {
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
keyconf->keyidx); keyconf->keyidx);
...@@ -232,7 +232,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, ...@@ -232,7 +232,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
{ {
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (keyconf->keylen != WEP_KEY_LEN_128 && if (keyconf->keylen != WEP_KEY_LEN_128 &&
keyconf->keylen != WEP_KEY_LEN_64) { keyconf->keylen != WEP_KEY_LEN_64) {
...@@ -397,7 +397,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, ...@@ -397,7 +397,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
return 0; return 0;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
ctx->key_mapping_keys--; ctx->key_mapping_keys--;
...@@ -430,7 +430,7 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, ...@@ -430,7 +430,7 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
return -EINVAL; return -EINVAL;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv); keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv);
if (keyconf->hw_key_idx == WEP_INVALID_OFFSET) if (keyconf->hw_key_idx == WEP_INVALID_OFFSET)
...@@ -572,7 +572,7 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) ...@@ -572,7 +572,7 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
unsigned long flags; unsigned long flags;
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* Remove "disable" flag, to enable Tx for this TID */ /* Remove "disable" flag, to enable Tx for this TID */
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->sta_lock, flags);
...@@ -592,7 +592,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, ...@@ -592,7 +592,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
int sta_id; int sta_id;
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
if (sta_id == IWL_INVALID_STATION) if (sta_id == IWL_INVALID_STATION)
...@@ -617,7 +617,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, ...@@ -617,7 +617,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
int sta_id; int sta_id;
struct iwl_addsta_cmd sta_cmd; struct iwl_addsta_cmd sta_cmd;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
......
...@@ -313,7 +313,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -313,7 +313,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
tt->tt_power_mode = IWL_POWER_INDEX_5; tt->tt_power_mode = IWL_POWER_INDEX_5;
break; break;
} }
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (old_state == IWL_TI_CT_KILL) if (old_state == IWL_TI_CT_KILL)
clear_bit(STATUS_CT_KILL, &priv->shrd->status); clear_bit(STATUS_CT_KILL, &priv->shrd->status);
if (tt->state != IWL_TI_CT_KILL && if (tt->state != IWL_TI_CT_KILL &&
...@@ -344,7 +344,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -344,7 +344,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
IWL_DEBUG_TEMP(priv, "Power Index change to %u\n", IWL_DEBUG_TEMP(priv, "Power Index change to %u\n",
tt->tt_power_mode); tt->tt_power_mode);
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
} }
...@@ -454,7 +454,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -454,7 +454,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
* in case get disabled before */ * in case get disabled before */
iwl_set_rxon_ht(priv, &priv->current_ht_config); iwl_set_rxon_ht(priv, &priv->current_ht_config);
} }
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (old_state == IWL_TI_CT_KILL) if (old_state == IWL_TI_CT_KILL)
clear_bit(STATUS_CT_KILL, &priv->shrd->status); clear_bit(STATUS_CT_KILL, &priv->shrd->status);
if (tt->state != IWL_TI_CT_KILL && if (tt->state != IWL_TI_CT_KILL &&
...@@ -489,7 +489,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -489,7 +489,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
iwl_perform_ct_kill_task(priv, false); iwl_perform_ct_kill_task(priv, false);
} }
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
} }
......
...@@ -545,7 +545,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) ...@@ -545,7 +545,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
struct iwl_notification_wait calib_wait; struct iwl_notification_wait calib_wait;
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* No init ucode required? Curious, but maybe ok */ /* No init ucode required? Curious, but maybe ok */
if (!priv->ucode_init.code.len) if (!priv->ucode_init.code.len)
......
This diff is collapsed.
...@@ -325,7 +325,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -325,7 +325,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
conf = ieee80211_get_hw_conf(priv->hw); conf = ieee80211_get_hw_conf(priv->hw);
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd)); memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd));
...@@ -1069,7 +1069,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) ...@@ -1069,7 +1069,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
bool defer; bool defer;
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (priv->tx_power_user_lmt == tx_power && !force) if (priv->tx_power_user_lmt == tx_power && !force)
return 0; return 0;
...@@ -1232,7 +1232,7 @@ static int iwl_setup_interface(struct iwl_priv *priv, ...@@ -1232,7 +1232,7 @@ static int iwl_setup_interface(struct iwl_priv *priv,
struct ieee80211_vif *vif = ctx->vif; struct ieee80211_vif *vif = ctx->vif;
int err; int err;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* /*
* This variable will be correct only when there's just * This variable will be correct only when there's just
...@@ -1276,7 +1276,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -1276,7 +1276,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
cancel_delayed_work_sync(&priv->hw_roc_disable_work); cancel_delayed_work_sync(&priv->hw_roc_disable_work);
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwlagn_disable_roc(priv); iwlagn_disable_roc(priv);
...@@ -1323,7 +1323,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -1323,7 +1323,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
ctx->vif = NULL; ctx->vif = NULL;
priv->iw_mode = NL80211_IFTYPE_STATION; priv->iw_mode = NL80211_IFTYPE_STATION;
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
return err; return err;
...@@ -1335,7 +1335,7 @@ static void iwl_teardown_interface(struct iwl_priv *priv, ...@@ -1335,7 +1335,7 @@ static void iwl_teardown_interface(struct iwl_priv *priv,
{ {
struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (priv->scan_vif == vif) { if (priv->scan_vif == vif) {
iwl_scan_cancel_timeout(priv, 200); iwl_scan_cancel_timeout(priv, 200);
...@@ -1367,14 +1367,14 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw, ...@@ -1367,14 +1367,14 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
WARN_ON(ctx->vif != vif); WARN_ON(ctx->vif != vif);
ctx->vif = NULL; ctx->vif = NULL;
iwl_teardown_interface(priv, vif, false); iwl_teardown_interface(priv, vif, false);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
...@@ -1698,7 +1698,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1698,7 +1698,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
newtype = ieee80211_iftype_p2p(newtype, newp2p); newtype = ieee80211_iftype_p2p(newtype, newp2p);
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (!ctx->vif || !iwl_is_ready_rf(priv)) { if (!ctx->vif || !iwl_is_ready_rf(priv)) {
/* /*
...@@ -1762,7 +1762,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1762,7 +1762,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
err = 0; err = 0;
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return err; return err;
} }
......
...@@ -819,9 +819,9 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file, ...@@ -819,9 +819,9 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
priv->power_data.debug_sleep_level_override = value; priv->power_data.debug_sleep_level_override = value;
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwl_power_update_mode(priv, true); iwl_power_update_mode(priv, true);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return count; return count;
} }
...@@ -1838,9 +1838,9 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, ...@@ -1838,9 +1838,9 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
return -EINVAL; return -EINVAL;
/* make request to uCode to retrieve statistics information */ /* make request to uCode to retrieve statistics information */
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
ret = iwl_send_statistics_request(priv, CMD_SYNC, false); ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
if (ret) { if (ret) {
IWL_ERR(priv, IWL_ERR(priv,
...@@ -2231,9 +2231,9 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file, ...@@ -2231,9 +2231,9 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file,
return -EFAULT; return -EFAULT;
/* make request to uCode to retrieve statistics information */ /* make request to uCode to retrieve statistics information */
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwl_send_statistics_request(priv, CMD_SYNC, true); iwl_send_statistics_request(priv, CMD_SYNC, true);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return count; return count;
} }
......
...@@ -1228,8 +1228,8 @@ struct iwl_priv { ...@@ -1228,8 +1228,8 @@ struct iwl_priv {
/* spinlock */ /* spinlock */
spinlock_t hcmd_lock; /* protect hcmd */ spinlock_t hcmd_lock; /* protect hcmd */
spinlock_t reg_lock; /* protect hw register access */ spinlock_t reg_lock; /* protect hw register access */
struct mutex mutex;
/*TODO: remove these pointers - use bus(priv) instead */
struct iwl_bus *bus; /* bus specific data */ struct iwl_bus *bus; /* bus specific data */
struct iwl_trans trans; struct iwl_trans trans;
......
...@@ -383,7 +383,7 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, ...@@ -383,7 +383,7 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
int ret; int ret;
bool update_chains; bool update_chains;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* Don't update the RX chain when chain noise calibration is running */ /* Don't update the RX chain when chain noise calibration is running */
update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE ||
......
...@@ -116,7 +116,7 @@ static void iwl_complete_scan(struct iwl_priv *priv, bool aborted) ...@@ -116,7 +116,7 @@ static void iwl_complete_scan(struct iwl_priv *priv, bool aborted)
void iwl_force_scan_end(struct iwl_priv *priv) void iwl_force_scan_end(struct iwl_priv *priv)
{ {
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) { if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
...@@ -134,7 +134,7 @@ static void iwl_do_scan_abort(struct iwl_priv *priv) ...@@ -134,7 +134,7 @@ static void iwl_do_scan_abort(struct iwl_priv *priv)
{ {
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) { if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
...@@ -173,7 +173,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) ...@@ -173,7 +173,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
{ {
unsigned long timeout = jiffies + msecs_to_jiffies(ms); unsigned long timeout = jiffies + msecs_to_jiffies(ms);
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n");
...@@ -358,7 +358,7 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv, ...@@ -358,7 +358,7 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
{ {
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
cancel_delayed_work(&priv->scan_check); cancel_delayed_work(&priv->scan_check);
...@@ -413,7 +413,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, ...@@ -413,7 +413,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
if (req->n_channels == 0) if (req->n_channels == 0)
return -EINVAL; return -EINVAL;
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (test_bit(STATUS_SCANNING, &priv->shrd->status) && if (test_bit(STATUS_SCANNING, &priv->shrd->status) &&
priv->scan_type != IWL_SCAN_NORMAL) { priv->scan_type != IWL_SCAN_NORMAL) {
...@@ -440,7 +440,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, ...@@ -440,7 +440,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
out_unlock: out_unlock:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return ret; return ret;
} }
...@@ -461,7 +461,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work) ...@@ -461,7 +461,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
IWL_DEBUG_SCAN(priv, "Start internal scan\n"); IWL_DEBUG_SCAN(priv, "Start internal scan\n");
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
if (priv->scan_type == IWL_SCAN_RADIO_RESET) { if (priv->scan_type == IWL_SCAN_RADIO_RESET) {
IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n"); IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n");
...@@ -476,7 +476,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work) ...@@ -476,7 +476,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
if (iwl_scan_initiate(priv, NULL, IWL_SCAN_RADIO_RESET, priv->band)) if (iwl_scan_initiate(priv, NULL, IWL_SCAN_RADIO_RESET, priv->band))
IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n"); IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n");
unlock: unlock:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
static void iwl_bg_scan_check(struct work_struct *data) static void iwl_bg_scan_check(struct work_struct *data)
...@@ -489,9 +489,9 @@ static void iwl_bg_scan_check(struct work_struct *data) ...@@ -489,9 +489,9 @@ static void iwl_bg_scan_check(struct work_struct *data)
/* Since we are here firmware does not finish scan and /* Since we are here firmware does not finish scan and
* most likely is in bad shape, so we don't bother to * most likely is in bad shape, so we don't bother to
* send abort command, just force scan complete to mac80211 */ * send abort command, just force scan complete to mac80211 */
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwl_force_scan_end(priv); iwl_force_scan_end(priv);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
/** /**
...@@ -549,9 +549,9 @@ static void iwl_bg_abort_scan(struct work_struct *work) ...@@ -549,9 +549,9 @@ static void iwl_bg_abort_scan(struct work_struct *work)
/* We keep scan_check work queued in case when firmware will not /* We keep scan_check work queued in case when firmware will not
* report back scan completed notification */ * report back scan completed notification */
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwl_scan_cancel_timeout(priv, 200); iwl_scan_cancel_timeout(priv, 200);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
static void iwl_bg_scan_completed(struct work_struct *work) static void iwl_bg_scan_completed(struct work_struct *work)
...@@ -564,7 +564,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) ...@@ -564,7 +564,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
cancel_delayed_work(&priv->scan_check); cancel_delayed_work(&priv->scan_check);
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status); aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
if (aborted) if (aborted)
...@@ -612,7 +612,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) ...@@ -612,7 +612,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
iwlagn_post_scan(priv); iwlagn_post_scan(priv);
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
void iwl_setup_scan_deferred_work(struct iwl_priv *priv) void iwl_setup_scan_deferred_work(struct iwl_priv *priv)
...@@ -630,8 +630,8 @@ void iwl_cancel_scan_deferred_work(struct iwl_priv *priv) ...@@ -630,8 +630,8 @@ void iwl_cancel_scan_deferred_work(struct iwl_priv *priv)
cancel_work_sync(&priv->scan_completed); cancel_work_sync(&priv->scan_completed);
if (cancel_delayed_work_sync(&priv->scan_check)) { if (cancel_delayed_work_sync(&priv->scan_check)) {
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwl_force_scan_end(priv); iwl_force_scan_end(priv);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
} }
...@@ -150,6 +150,7 @@ struct iwl_hw_params { ...@@ -150,6 +150,7 @@ struct iwl_hw_params {
* @hw_params: see struct iwl_hw_params * @hw_params: see struct iwl_hw_params
* @workqueue: the workqueue used by all the layers of the driver * @workqueue: the workqueue used by all the layers of the driver
* @lock: protect general shared data * @lock: protect general shared data
* @mutex:
*/ */
struct iwl_shared { struct iwl_shared {
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
...@@ -165,6 +166,7 @@ struct iwl_shared { ...@@ -165,6 +166,7 @@ struct iwl_shared {
struct workqueue_struct *workqueue; struct workqueue_struct *workqueue;
spinlock_t lock; spinlock_t lock;
struct mutex mutex;
}; };
/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */ /*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */
......
...@@ -821,13 +821,13 @@ int iwl_mac_sta_remove(struct ieee80211_hw *hw, ...@@ -821,13 +821,13 @@ int iwl_mac_sta_remove(struct ieee80211_hw *hw,
IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", IWL_DEBUG_INFO(priv, "received request to remove station %pM\n",
sta->addr); sta->addr);
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
sta->addr); sta->addr);
ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr); ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr);
if (ret) if (ret)
IWL_ERR(priv, "Error removing station %pM\n", IWL_ERR(priv, "Error removing station %pM\n",
sta->addr); sta->addr);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return ret; return ret;
} }
...@@ -661,7 +661,7 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) ...@@ -661,7 +661,7 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
return -ENOMSG; return -ENOMSG;
} }
/* in case multiple accesses to the device happens */ /* in case multiple accesses to the device happens */
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
case IWL_TM_CMD_APP2DEV_UCODE: case IWL_TM_CMD_APP2DEV_UCODE:
...@@ -702,7 +702,7 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) ...@@ -702,7 +702,7 @@ int iwl_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
break; break;
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return result; return result;
} }
...@@ -738,7 +738,7 @@ int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -738,7 +738,7 @@ int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
} }
/* in case multiple accesses to the device happens */ /* in case multiple accesses to the device happens */
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
switch (cmd) { switch (cmd) {
case IWL_TM_CMD_APP2DEV_READ_TRACE: case IWL_TM_CMD_APP2DEV_READ_TRACE:
IWL_DEBUG_INFO(priv, "uCode trace cmd to driver\n"); IWL_DEBUG_INFO(priv, "uCode trace cmd to driver\n");
...@@ -749,6 +749,6 @@ int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -749,6 +749,6 @@ int iwl_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
break; break;
} }
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
return result; return result;
} }
...@@ -349,9 +349,9 @@ void iwl_bg_rx_replenish(struct work_struct *data) ...@@ -349,9 +349,9 @@ void iwl_bg_rx_replenish(struct work_struct *data)
if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
return; return;
mutex_lock(&priv->mutex); mutex_lock(&priv->shrd->mutex);
iwlagn_rx_replenish(priv); iwlagn_rx_replenish(priv);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->shrd->mutex);
} }
/** /**
......
...@@ -934,7 +934,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -934,7 +934,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
int cmd_idx; int cmd_idx;
int ret; int ret;
lockdep_assert_held(&priv->mutex); lockdep_assert_held(&priv->shrd->mutex);
/* A synchronous command can not have a callback set. */ /* A synchronous command can not have a callback set. */
if (WARN_ON(cmd->callback)) if (WARN_ON(cmd->callback))
......
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