Commit 5d8e4237d2dc73b51ac66dc612c5c42dd7424479

Authored by Johannes Berg
1 parent 04b7b2ff50

mac80211: change locking around ieee80211_recalc_smps

Make the function acquire the necessary mutex itself
to simplify the callers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Showing 4 changed files with 5 additions and 8 deletions Side-by-side Diff

... ... @@ -2070,9 +2070,7 @@
2070 2070 */
2071 2071 if (!sdata->u.mgd.associated ||
2072 2072 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) {
2073   - mutex_lock(&sdata->local->iflist_mtx);
2074 2073 ieee80211_recalc_smps(sdata->local);
2075   - mutex_unlock(&sdata->local->iflist_mtx);
2076 2074 return 0;
2077 2075 }
2078 2076  
... ... @@ -364,9 +364,7 @@
364 364 struct ieee80211_local *local =
365 365 container_of(work, struct ieee80211_local, recalc_smps);
366 366  
367   - mutex_lock(&local->iflist_mtx);
368 367 ieee80211_recalc_smps(local);
369   - mutex_unlock(&local->iflist_mtx);
370 368 }
371 369  
372 370 #ifdef CONFIG_INET
... ... @@ -1348,9 +1348,9 @@
1348 1348  
1349 1349 mutex_lock(&local->iflist_mtx);
1350 1350 ieee80211_recalc_ps(local, -1);
1351   - ieee80211_recalc_smps(local);
1352 1351 mutex_unlock(&local->iflist_mtx);
1353 1352  
  1353 + ieee80211_recalc_smps(local);
1354 1354 ieee80211_recalc_ps_vif(sdata);
1355 1355  
1356 1356 netif_tx_start_all_queues(sdata->dev);
... ... @@ -1606,14 +1606,13 @@
1606 1606 return 0;
1607 1607 }
1608 1608  
1609   -/* must hold iflist_mtx */
1610 1609 void ieee80211_recalc_smps(struct ieee80211_local *local)
1611 1610 {
1612 1611 struct ieee80211_sub_if_data *sdata;
1613 1612 enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_OFF;
1614 1613 int count = 0;
1615 1614  
1616   - lockdep_assert_held(&local->iflist_mtx);
  1615 + mutex_lock(&local->iflist_mtx);
1617 1616  
1618 1617 /*
1619 1618 * This function could be improved to handle multiple
1620 1619  
... ... @@ -1642,12 +1641,14 @@
1642 1641 }
1643 1642  
1644 1643 if (smps_mode == local->smps_mode)
1645   - return;
  1644 + goto unlock;
1646 1645  
1647 1646 set:
1648 1647 local->smps_mode = smps_mode;
1649 1648 /* changed flag is auto-detected for this */
1650 1649 ieee80211_hw_config(local, 0);
  1650 + unlock:
  1651 + mutex_unlock(&local->iflist_mtx);
1651 1652 }
1652 1653  
1653 1654 static bool ieee80211_id_in_list(const u8 *ids, int n_ids, u8 id)