Commit 08ae86ac authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

iwlwifi: remove shared lock

Some data doesn't need protection, some of the
lock places are simply useless, and some data
can be protected with the mutex instead. Thus
the shared lock can be removed by making those
changes.
Signed-off-by: default avatarJohannes Berg <johannes.berg@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 4ff70fcd
...@@ -63,12 +63,8 @@ ...@@ -63,12 +63,8 @@
/* NIC configuration for 5000 series */ /* NIC configuration for 5000 series */
static void iwl5000_nic_config(struct iwl_priv *priv) static void iwl5000_nic_config(struct iwl_priv *priv)
{ {
unsigned long flags;
iwl_rf_config(priv); iwl_rf_config(priv);
spin_lock_irqsave(&priv->shrd->lock, flags);
/* W/A : NIC is stuck in a reset state after Early PCIe power off /* W/A : NIC is stuck in a reset state after Early PCIe power off
* (PCIe power is lost before PERST# is asserted), * (PCIe power is lost before PERST# is asserted),
* causing ME FW to lose ownership and not being able to obtain it back. * causing ME FW to lose ownership and not being able to obtain it back.
...@@ -76,9 +72,6 @@ static void iwl5000_nic_config(struct iwl_priv *priv) ...@@ -76,9 +72,6 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
iwl_set_bits_mask_prph(trans(priv), APMG_PS_CTRL_REG, iwl_set_bits_mask_prph(trans(priv), APMG_PS_CTRL_REG,
APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
spin_unlock_irqrestore(&priv->shrd->lock, flags);
} }
static struct iwl_sensitivity_ranges iwl5000_sensitivity = { static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
......
...@@ -710,7 +710,6 @@ int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, ...@@ -710,7 +710,6 @@ int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
struct iwl_rx_mem_buffer *rxb, struct iwl_rx_mem_buffer *rxb,
struct iwl_device_cmd *cmd) struct iwl_device_cmd *cmd)
{ {
unsigned long flags;
struct iwl_rx_packet *pkt = rxb_addr(rxb); struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif; struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif;
struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg; struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg;
...@@ -756,9 +755,7 @@ int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, ...@@ -756,9 +755,7 @@ int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
/* FIXME: based on notification, adjust the prio_boost */ /* FIXME: based on notification, adjust the prio_boost */
spin_lock_irqsave(&priv->shrd->lock, flags);
priv->bt_ci_compliance = coex->bt_ci_compliance; priv->bt_ci_compliance = coex->bt_ci_compliance;
spin_unlock_irqrestore(&priv->shrd->lock, flags);
return 0; return 0;
} }
......
...@@ -870,19 +870,16 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -870,19 +870,16 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
{ {
struct iwl_scale_tbl_info *tbl; struct iwl_scale_tbl_info *tbl;
bool full_concurrent = priv->bt_full_concurrent; bool full_concurrent = priv->bt_full_concurrent;
unsigned long flags;
if (priv->bt_ant_couple_ok) { if (priv->bt_ant_couple_ok) {
/* /*
* Is there a need to switch between * Is there a need to switch between
* full concurrency and 3-wire? * full concurrency and 3-wire?
*/ */
spin_lock_irqsave(&priv->shrd->lock, flags);
if (priv->bt_ci_compliance && priv->bt_ant_couple_ok) if (priv->bt_ci_compliance && priv->bt_ant_couple_ok)
full_concurrent = true; full_concurrent = true;
else else
full_concurrent = false; full_concurrent = false;
spin_unlock_irqrestore(&priv->shrd->lock, flags);
} }
if ((priv->bt_traffic_load != priv->last_bt_traffic_load) || if ((priv->bt_traffic_load != priv->last_bt_traffic_load) ||
(priv->bt_full_concurrent != full_concurrent)) { (priv->bt_full_concurrent != full_concurrent)) {
......
...@@ -590,8 +590,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -590,8 +590,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
} }
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
unsigned long flags;
ch_info = iwl_get_channel_info(priv, channel->band, ch_info = iwl_get_channel_info(priv, channel->band,
channel->hw_value); channel->hw_value);
if (!is_channel_valid(ch_info)) { if (!is_channel_valid(ch_info)) {
...@@ -600,8 +598,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -600,8 +598,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
goto out; goto out;
} }
spin_lock_irqsave(&priv->shrd->lock, flags);
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
/* Configure HT40 channels */ /* Configure HT40 channels */
if (ctx->ht.enabled != conf_is_ht(conf)) if (ctx->ht.enabled != conf_is_ht(conf))
...@@ -636,8 +632,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -636,8 +632,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
ctx->vif); ctx->vif);
} }
spin_unlock_irqrestore(&priv->shrd->lock, flags);
iwl_update_bcast_stations(priv); iwl_update_bcast_stations(priv);
/* /*
......
...@@ -259,18 +259,15 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -259,18 +259,15 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl_device_cmd *dev_cmd = NULL; struct iwl_device_cmd *dev_cmd = NULL;
struct iwl_tx_cmd *tx_cmd; struct iwl_tx_cmd *tx_cmd;
__le16 fc; __le16 fc;
u8 hdr_len; u8 hdr_len;
u16 len, seq_number = 0; u16 len, seq_number = 0;
u8 sta_id, tid = IWL_MAX_TID_COUNT; u8 sta_id, tid = IWL_MAX_TID_COUNT;
unsigned long flags;
bool is_agg = false; bool is_agg = false;
if (info->control.vif) if (info->control.vif)
ctx = iwl_rxon_ctx_from_vif(info->control.vif); ctx = iwl_rxon_ctx_from_vif(info->control.vif);
spin_lock_irqsave(&priv->shrd->lock, flags);
if (iwl_is_rfkill(priv->shrd)) { if (iwl_is_rfkill(priv->shrd)) {
IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
goto drop_unlock_priv; goto drop_unlock_priv;
...@@ -369,7 +366,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -369,7 +366,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
info->driver_data[0] = ctx; info->driver_data[0] = ctx;
info->driver_data[1] = dev_cmd; info->driver_data[1] = dev_cmd;
/* irqs already disabled/saved above when locking priv->shrd->lock */
spin_lock(&priv->sta_lock); spin_lock(&priv->sta_lock);
if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) { if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) {
...@@ -418,7 +414,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -418,7 +414,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
priv->tid_data[sta_id][tid].seq_number = seq_number; priv->tid_data[sta_id][tid].seq_number = seq_number;
spin_unlock(&priv->sta_lock); spin_unlock(&priv->sta_lock);
spin_unlock_irqrestore(&priv->shrd->lock, flags);
/* /*
* Avoid atomic ops if it isn't an associated client. * Avoid atomic ops if it isn't an associated client.
...@@ -437,7 +432,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -437,7 +432,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
kmem_cache_free(priv->tx_cmd_pool, dev_cmd); kmem_cache_free(priv->tx_cmd_pool, dev_cmd);
spin_unlock(&priv->sta_lock); spin_unlock(&priv->sta_lock);
drop_unlock_priv: drop_unlock_priv:
spin_unlock_irqrestore(&priv->shrd->lock, flags);
return -1; return -1;
} }
...@@ -445,7 +439,6 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -445,7 +439,6 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid) struct ieee80211_sta *sta, u16 tid)
{ {
struct iwl_tid_data *tid_data; struct iwl_tid_data *tid_data;
unsigned long flags;
int sta_id; int sta_id;
sta_id = iwl_sta_id(sta); sta_id = iwl_sta_id(sta);
...@@ -500,9 +493,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -500,9 +493,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
spin_unlock_bh(&priv->sta_lock); spin_unlock_bh(&priv->sta_lock);
spin_lock_irqsave(&priv->shrd->lock, flags);
iwl_trans_tx_agg_disable(trans(priv), sta_id, tid); iwl_trans_tx_agg_disable(trans(priv), sta_id, tid);
spin_unlock_irqrestore(&priv->shrd->lock, flags);
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
......
...@@ -552,13 +552,11 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv) ...@@ -552,13 +552,11 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
{ {
struct iwl_ct_kill_config cmd; struct iwl_ct_kill_config cmd;
struct iwl_ct_kill_throttling_config adv_cmd; struct iwl_ct_kill_throttling_config adv_cmd;
unsigned long flags;
int ret = 0; int ret = 0;
spin_lock_irqsave(&priv->shrd->lock, flags);
iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR, iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR,
CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
spin_unlock_irqrestore(&priv->shrd->lock, flags);
priv->thermal_throttle.ct_kill_toggle = false; priv->thermal_throttle.ct_kill_toggle = false;
if (cfg(priv)->base_params->support_ct_kill_exit) { if (cfg(priv)->base_params->support_ct_kill_exit) {
...@@ -1232,7 +1230,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans) ...@@ -1232,7 +1230,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans)
* we should init now * we should init now
*/ */
spin_lock_init(&trans(priv)->reg_lock); spin_lock_init(&trans(priv)->reg_lock);
spin_lock_init(&priv->shrd->lock);
spin_lock_init(&priv->statistics.lock); spin_lock_init(&priv->statistics.lock);
/*********************** /***********************
......
...@@ -719,10 +719,6 @@ struct iwl_priv { ...@@ -719,10 +719,6 @@ struct iwl_priv {
/*data shared among all the driver's layers */ /*data shared among all the driver's layers */
struct iwl_shared *shrd; struct iwl_shared *shrd;
/*
* protects the station table, if shrd->lock and sta_lock are
* needed, shrd->lock must be acquired first
*/
spinlock_t sta_lock; spinlock_t sta_lock;
/* ieee device used by generic ieee processing code */ /* ieee device used by generic ieee processing code */
......
...@@ -779,8 +779,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -779,8 +779,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
goto out; goto out;
} }
spin_lock_irq(&priv->shrd->lock);
priv->current_ht_config.smps = conf->smps_mode; priv->current_ht_config.smps = conf->smps_mode;
/* Configure HT40 channels */ /* Configure HT40 channels */
...@@ -797,8 +795,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -797,8 +795,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
iwl_set_rxon_ht(priv, ht_conf); iwl_set_rxon_ht(priv, ht_conf);
iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
spin_unlock_irq(&priv->shrd->lock);
iwl_set_rate(priv); iwl_set_rate(priv);
/* /*
* at this point, staging_rxon has the * at this point, staging_rxon has the
...@@ -1133,7 +1129,6 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, ...@@ -1133,7 +1129,6 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
struct iwl_rxon_context *ctx = vif_priv->ctx; struct iwl_rxon_context *ctx = vif_priv->ctx;
unsigned long flags;
int q; int q;
if (WARN_ON(!ctx)) if (WARN_ON(!ctx))
...@@ -1153,7 +1148,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, ...@@ -1153,7 +1148,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,
q = AC_NUM - 1 - queue; q = AC_NUM - 1 - queue;
spin_lock_irqsave(&priv->shrd->lock, flags); mutex_lock(&priv->shrd->mutex);
ctx->qos_data.def_qos_parm.ac[q].cw_min = ctx->qos_data.def_qos_parm.ac[q].cw_min =
cpu_to_le16(params->cw_min); cpu_to_le16(params->cw_min);
...@@ -1165,7 +1160,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, ...@@ -1165,7 +1160,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,
ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0;
spin_unlock_irqrestore(&priv->shrd->lock, flags); mutex_unlock(&priv->shrd->mutex);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
return 0; return 0;
......
...@@ -388,7 +388,6 @@ struct iwl_shared { ...@@ -388,7 +388,6 @@ struct iwl_shared {
struct iwl_nic *nic; struct iwl_nic *nic;
struct iwl_hw_params hw_params; struct iwl_hw_params hw_params;
spinlock_t lock;
struct mutex mutex; struct mutex mutex;
wait_queue_head_t wait_command_queue; wait_queue_head_t wait_command_queue;
......
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