aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/pm.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-12-13 10:47:42 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-01-03 07:01:33 -0500
commit61e8a48cc1283c8e4358b3ce06305d886c55f7ce (patch)
treea5c76f553833866727994e8ade191071efde9c1c /net/mac80211/pm.c
parentd45c41722a3eca639ced2c4c93665ced229b1da9 (diff)
mac80211: clean up ieee80211_quiesce
It's a bit odd that there's a return value that only depends on the iftype, move that logic out of the function into the only caller that needs it. Also, since the quiescing could stop timers that trigger the sdata work, move the sdata work cancel into the function and after the actual quiesce. Finally, there's no need to call it on interfaces that are down, so don't. Change-Id: I1632d46d21ba3558ea713d035184f1939905f2f1 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/pm.c')
-rw-r--r--net/mac80211/pm.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 79a48f37d409..f3217831d236 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -7,25 +7,23 @@
7#include "led.h" 7#include "led.h"
8 8
9/* return value indicates whether the driver should be further notified */ 9/* return value indicates whether the driver should be further notified */
10static bool ieee80211_quiesce(struct ieee80211_sub_if_data *sdata) 10static void ieee80211_quiesce(struct ieee80211_sub_if_data *sdata)
11{ 11{
12 switch (sdata->vif.type) { 12 switch (sdata->vif.type) {
13 case NL80211_IFTYPE_STATION: 13 case NL80211_IFTYPE_STATION:
14 ieee80211_sta_quiesce(sdata); 14 ieee80211_sta_quiesce(sdata);
15 return true; 15 break;
16 case NL80211_IFTYPE_ADHOC: 16 case NL80211_IFTYPE_ADHOC:
17 ieee80211_ibss_quiesce(sdata); 17 ieee80211_ibss_quiesce(sdata);
18 return true; 18 break;
19 case NL80211_IFTYPE_MESH_POINT: 19 case NL80211_IFTYPE_MESH_POINT:
20 ieee80211_mesh_quiesce(sdata); 20 ieee80211_mesh_quiesce(sdata);
21 return true; 21 break;
22 case NL80211_IFTYPE_AP_VLAN:
23 case NL80211_IFTYPE_MONITOR:
24 /* don't tell driver about this */
25 return false;
26 default: 22 default:
27 return true; 23 break;
28 } 24 }
25
26 cancel_work_sync(&sdata->work);
29} 27}
30 28
31int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) 29int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
@@ -94,10 +92,9 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
94 WARN_ON(err != 1); 92 WARN_ON(err != 1);
95 local->wowlan = false; 93 local->wowlan = false;
96 } else { 94 } else {
97 list_for_each_entry(sdata, &local->interfaces, list) { 95 list_for_each_entry(sdata, &local->interfaces, list)
98 cancel_work_sync(&sdata->work); 96 if (ieee80211_sdata_running(sdata))
99 ieee80211_quiesce(sdata); 97 ieee80211_quiesce(sdata);
100 }
101 goto suspend; 98 goto suspend;
102 } 99 }
103 } 100 }
@@ -124,13 +121,18 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
124 121
125 /* remove all interfaces */ 122 /* remove all interfaces */
126 list_for_each_entry(sdata, &local->interfaces, list) { 123 list_for_each_entry(sdata, &local->interfaces, list) {
127 cancel_work_sync(&sdata->work); 124 if (!ieee80211_sdata_running(sdata))
128
129 if (!ieee80211_quiesce(sdata))
130 continue; 125 continue;
131 126
132 if (!ieee80211_sdata_running(sdata)) 127 switch (sdata->vif.type) {
128 case NL80211_IFTYPE_AP_VLAN:
129 case NL80211_IFTYPE_MONITOR:
130 /* skip these */
133 continue; 131 continue;
132 default:
133 ieee80211_quiesce(sdata);
134 break;
135 }
134 136
135 /* disable beaconing */ 137 /* disable beaconing */
136 ieee80211_bss_info_change_notify(sdata, 138 ieee80211_bss_info_change_notify(sdata,