Skip to content

Commit a24d52f

Browse files
jmberg-intellinvjw
authored andcommitted
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: [email protected] [2.6.34+, maybe only parts of patch] Reported-by: Thomas Meyer <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent e95b743 commit a24d52f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

drivers/net/wireless/iwlwifi/iwl-agn-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
14291429
void iwl_free_tfds_in_queue(struct iwl_priv *priv,
14301430
int sta_id, int tid, int freed)
14311431
{
1432-
WARN_ON(!spin_is_locked(&priv->sta_lock));
1432+
lockdep_assert_held(&priv->sta_lock);
14331433

14341434
if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
14351435
priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;

drivers/net/wireless/iwlwifi/iwl-agn-tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
11171117
u8 *addr = priv->stations[sta_id].sta.sta.addr;
11181118
struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid];
11191119

1120-
WARN_ON(!spin_is_locked(&priv->sta_lock));
1120+
lockdep_assert_held(&priv->sta_lock);
11211121

11221122
switch (priv->stations[sta_id].tid[tid].agg.state) {
11231123
case IWL_EMPTYING_HW_QUEUE_DELBA:

drivers/net/wireless/iwlwifi/iwl-scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ EXPORT_SYMBOL(iwl_init_scan_params);
298298

299299
static int iwl_scan_initiate(struct iwl_priv *priv, struct ieee80211_vif *vif)
300300
{
301-
WARN_ON(!mutex_is_locked(&priv->mutex));
301+
lockdep_assert_held(&priv->mutex);
302302

303303
IWL_DEBUG_INFO(priv, "Starting scan...\n");
304304
set_bit(STATUS_SCANNING, &priv->status);

drivers/net/wireless/iwlwifi/iwl-sta.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)
773773

774774
int iwl_restore_default_wep_keys(struct iwl_priv *priv)
775775
{
776-
WARN_ON(!mutex_is_locked(&priv->mutex));
776+
lockdep_assert_held(&priv->mutex);
777777

778778
return iwl_send_static_wepkey_cmd(priv, 0);
779779
}
@@ -784,7 +784,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
784784
{
785785
int ret;
786786

787-
WARN_ON(!mutex_is_locked(&priv->mutex));
787+
lockdep_assert_held(&priv->mutex);
788788

789789
IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
790790
keyconf->keyidx);
@@ -808,7 +808,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
808808
{
809809
int ret;
810810

811-
WARN_ON(!mutex_is_locked(&priv->mutex));
811+
lockdep_assert_held(&priv->mutex);
812812

813813
if (keyconf->keylen != WEP_KEY_LEN_128 &&
814814
keyconf->keylen != WEP_KEY_LEN_64) {

0 commit comments

Comments
 (0)