aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-09-11 04:17:11 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-09-14 08:09:25 -0400
commit5d8e4237d2dc73b51ac66dc612c5c42dd7424479 (patch)
tree7682e303361f1400abf693a465db672d864f227d /net/mac80211
parent04b7b2ff50fc77380c1e711f1d7223734547e41b (diff)
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>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c2
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/mlme.c2
-rw-r--r--net/mac80211/util.c7
4 files changed, 5 insertions, 8 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 00e31b488adc..9bd56a744982 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2070,9 +2070,7 @@ int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
2070 */ 2070 */
2071 if (!sdata->u.mgd.associated || 2071 if (!sdata->u.mgd.associated ||
2072 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) { 2072 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) {
2073 mutex_lock(&sdata->local->iflist_mtx);
2074 ieee80211_recalc_smps(sdata->local); 2073 ieee80211_recalc_smps(sdata->local);
2075 mutex_unlock(&sdata->local->iflist_mtx);
2076 return 0; 2074 return 0;
2077 } 2075 }
2078 2076
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 416e85eae2d2..c80c4490351c 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -364,9 +364,7 @@ static void ieee80211_recalc_smps_work(struct work_struct *work)
364 struct ieee80211_local *local = 364 struct ieee80211_local *local =
365 container_of(work, struct ieee80211_local, recalc_smps); 365 container_of(work, struct ieee80211_local, recalc_smps);
366 366
367 mutex_lock(&local->iflist_mtx);
368 ieee80211_recalc_smps(local); 367 ieee80211_recalc_smps(local);
369 mutex_unlock(&local->iflist_mtx);
370} 368}
371 369
372#ifdef CONFIG_INET 370#ifdef CONFIG_INET
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 45a9fa63b368..2dbd9e1e3583 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1348,9 +1348,9 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1348 1348
1349 mutex_lock(&local->iflist_mtx); 1349 mutex_lock(&local->iflist_mtx);
1350 ieee80211_recalc_ps(local, -1); 1350 ieee80211_recalc_ps(local, -1);
1351 ieee80211_recalc_smps(local);
1352 mutex_unlock(&local->iflist_mtx); 1351 mutex_unlock(&local->iflist_mtx);
1353 1352
1353 ieee80211_recalc_smps(local);
1354 ieee80211_recalc_ps_vif(sdata); 1354 ieee80211_recalc_ps_vif(sdata);
1355 1355
1356 netif_tx_start_all_queues(sdata->dev); 1356 netif_tx_start_all_queues(sdata->dev);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 2017904c69cc..22ca35054dd0 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1606,14 +1606,13 @@ static int check_mgd_smps(struct ieee80211_if_managed *ifmgd,
1606 return 0; 1606 return 0;
1607} 1607}
1608 1608
1609/* must hold iflist_mtx */
1610void ieee80211_recalc_smps(struct ieee80211_local *local) 1609void ieee80211_recalc_smps(struct ieee80211_local *local)
1611{ 1610{
1612 struct ieee80211_sub_if_data *sdata; 1611 struct ieee80211_sub_if_data *sdata;
1613 enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_OFF; 1612 enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_OFF;
1614 int count = 0; 1613 int count = 0;
1615 1614
1616 lockdep_assert_held(&local->iflist_mtx); 1615 mutex_lock(&local->iflist_mtx);
1617 1616
1618 /* 1617 /*
1619 * This function could be improved to handle multiple 1618 * This function could be improved to handle multiple
@@ -1642,12 +1641,14 @@ void ieee80211_recalc_smps(struct ieee80211_local *local)
1642 } 1641 }
1643 1642
1644 if (smps_mode == local->smps_mode) 1643 if (smps_mode == local->smps_mode)
1645 return; 1644 goto unlock;
1646 1645
1647 set: 1646 set:
1648 local->smps_mode = smps_mode; 1647 local->smps_mode = smps_mode;
1649 /* changed flag is auto-detected for this */ 1648 /* changed flag is auto-detected for this */
1650 ieee80211_hw_config(local, 0); 1649 ieee80211_hw_config(local, 0);
1650 unlock:
1651 mutex_unlock(&local->iflist_mtx);
1651} 1652}
1652 1653
1653static bool ieee80211_id_in_list(const u8 *ids, int n_ids, u8 id) 1654static bool ieee80211_id_in_list(const u8 *ids, int n_ids, u8 id)