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

iwlwifi: fix locking assertions

spin_is_locked() can return zero on some (UP?)
configurations because locks don't exist, and
that causes an endless amount of warnings. Use
lockdep_assert_held() instead, which has two
advantages:
 1) it verifies the current task is holding
    the lock or mutex
 2) it compiles away completely when lockdep
    is not enabled

Cc: stable@kernel.org [2.6.34+, maybe only parts of patch]
Reported-by: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e95b7435
...@@ -1429,7 +1429,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv, ...@@ -1429,7 +1429,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
void iwl_free_tfds_in_queue(struct iwl_priv *priv, void iwl_free_tfds_in_queue(struct iwl_priv *priv,
int sta_id, int tid, int freed) int sta_id, int tid, int freed)
{ {
WARN_ON(!spin_is_locked(&priv->sta_lock)); lockdep_assert_held(&priv->sta_lock);
if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
......
...@@ -1117,7 +1117,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv, ...@@ -1117,7 +1117,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
u8 *addr = priv->stations[sta_id].sta.sta.addr; u8 *addr = priv->stations[sta_id].sta.sta.addr;
struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid];
WARN_ON(!spin_is_locked(&priv->sta_lock)); lockdep_assert_held(&priv->sta_lock);
switch (priv->stations[sta_id].tid[tid].agg.state) { switch (priv->stations[sta_id].tid[tid].agg.state) {
case IWL_EMPTYING_HW_QUEUE_DELBA: case IWL_EMPTYING_HW_QUEUE_DELBA:
......
...@@ -298,7 +298,7 @@ EXPORT_SYMBOL(iwl_init_scan_params); ...@@ -298,7 +298,7 @@ EXPORT_SYMBOL(iwl_init_scan_params);
static int iwl_scan_initiate(struct iwl_priv *priv, struct ieee80211_vif *vif) static int iwl_scan_initiate(struct iwl_priv *priv, struct ieee80211_vif *vif)
{ {
WARN_ON(!mutex_is_locked(&priv->mutex)); lockdep_assert_held(&priv->mutex);
IWL_DEBUG_INFO(priv, "Starting scan...\n"); IWL_DEBUG_INFO(priv, "Starting scan...\n");
set_bit(STATUS_SCANNING, &priv->status); set_bit(STATUS_SCANNING, &priv->status);
......
...@@ -773,7 +773,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) ...@@ -773,7 +773,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)
int iwl_restore_default_wep_keys(struct iwl_priv *priv) int iwl_restore_default_wep_keys(struct iwl_priv *priv)
{ {
WARN_ON(!mutex_is_locked(&priv->mutex)); lockdep_assert_held(&priv->mutex);
return iwl_send_static_wepkey_cmd(priv, 0); return iwl_send_static_wepkey_cmd(priv, 0);
} }
...@@ -784,7 +784,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, ...@@ -784,7 +784,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
{ {
int ret; int ret;
WARN_ON(!mutex_is_locked(&priv->mutex)); lockdep_assert_held(&priv->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);
...@@ -808,7 +808,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, ...@@ -808,7 +808,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
{ {
int ret; int ret;
WARN_ON(!mutex_is_locked(&priv->mutex)); lockdep_assert_held(&priv->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) {
......
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