diff options
author | Kalle Valo <kalle.valo@iki.fi> | 2009-12-23 07:15:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-28 16:55:10 -0500 |
commit | e1781ed33a8809c58ad6c3b6d432d656446efa43 (patch) | |
tree | 4d272bc5bf25263a67b8431e7cfac6f9bbbcb690 /net/mac80211/driver-ops.h | |
parent | 095d5ef608b58ece49f4131925700d27314ecdd8 (diff) |
mac80211: annotate sleeping driver ops
To make it easier to notice cases of calling sleeping ops in atomic context,
annotate driver-ops.h with appropiate might_sleep() calls. At the same time,
also document in mac80211.h the op functions with missing contexts.
mac80211 doesn't seem to use get_tx_stats anywhere currently. Just to be on
the safe side, I documented it to be atomic, but hopefully the op can be
removed in the future.
Compile-tested only.
Signed-off-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/driver-ops.h')
-rw-r--r-- | net/mac80211/driver-ops.h | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index bc7c8f55487..8757ea73d54 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -14,6 +14,8 @@ static inline int drv_start(struct ieee80211_local *local) | |||
14 | { | 14 | { |
15 | int ret; | 15 | int ret; |
16 | 16 | ||
17 | might_sleep(); | ||
18 | |||
17 | local->started = true; | 19 | local->started = true; |
18 | smp_mb(); | 20 | smp_mb(); |
19 | ret = local->ops->start(&local->hw); | 21 | ret = local->ops->start(&local->hw); |
@@ -23,6 +25,8 @@ static inline int drv_start(struct ieee80211_local *local) | |||
23 | 25 | ||
24 | static inline void drv_stop(struct ieee80211_local *local) | 26 | static inline void drv_stop(struct ieee80211_local *local) |
25 | { | 27 | { |
28 | might_sleep(); | ||
29 | |||
26 | local->ops->stop(&local->hw); | 30 | local->ops->stop(&local->hw); |
27 | trace_drv_stop(local); | 31 | trace_drv_stop(local); |
28 | 32 | ||
@@ -38,7 +42,11 @@ static inline void drv_stop(struct ieee80211_local *local) | |||
38 | static inline int drv_add_interface(struct ieee80211_local *local, | 42 | static inline int drv_add_interface(struct ieee80211_local *local, |
39 | struct ieee80211_vif *vif) | 43 | struct ieee80211_vif *vif) |
40 | { | 44 | { |
41 | int ret = local->ops->add_interface(&local->hw, vif); | 45 | int ret; |
46 | |||
47 | might_sleep(); | ||
48 | |||
49 | ret = local->ops->add_interface(&local->hw, vif); | ||
42 | trace_drv_add_interface(local, vif_to_sdata(vif), ret); | 50 | trace_drv_add_interface(local, vif_to_sdata(vif), ret); |
43 | return ret; | 51 | return ret; |
44 | } | 52 | } |
@@ -46,13 +54,19 @@ static inline int drv_add_interface(struct ieee80211_local *local, | |||
46 | static inline void drv_remove_interface(struct ieee80211_local *local, | 54 | static inline void drv_remove_interface(struct ieee80211_local *local, |
47 | struct ieee80211_vif *vif) | 55 | struct ieee80211_vif *vif) |
48 | { | 56 | { |
57 | might_sleep(); | ||
58 | |||
49 | local->ops->remove_interface(&local->hw, vif); | 59 | local->ops->remove_interface(&local->hw, vif); |
50 | trace_drv_remove_interface(local, vif_to_sdata(vif)); | 60 | trace_drv_remove_interface(local, vif_to_sdata(vif)); |
51 | } | 61 | } |
52 | 62 | ||
53 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | 63 | static inline int drv_config(struct ieee80211_local *local, u32 changed) |
54 | { | 64 | { |
55 | int ret = local->ops->config(&local->hw, changed); | 65 | int ret; |
66 | |||
67 | might_sleep(); | ||
68 | |||
69 | ret = local->ops->config(&local->hw, changed); | ||
56 | trace_drv_config(local, changed, ret); | 70 | trace_drv_config(local, changed, ret); |
57 | return ret; | 71 | return ret; |
58 | } | 72 | } |
@@ -62,6 +76,8 @@ static inline void drv_bss_info_changed(struct ieee80211_local *local, | |||
62 | struct ieee80211_bss_conf *info, | 76 | struct ieee80211_bss_conf *info, |
63 | u32 changed) | 77 | u32 changed) |
64 | { | 78 | { |
79 | might_sleep(); | ||
80 | |||
65 | if (local->ops->bss_info_changed) | 81 | if (local->ops->bss_info_changed) |
66 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); | 82 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
67 | trace_drv_bss_info_changed(local, sdata, info, changed); | 83 | trace_drv_bss_info_changed(local, sdata, info, changed); |
@@ -111,7 +127,11 @@ static inline int drv_set_key(struct ieee80211_local *local, | |||
111 | struct ieee80211_sta *sta, | 127 | struct ieee80211_sta *sta, |
112 | struct ieee80211_key_conf *key) | 128 | struct ieee80211_key_conf *key) |
113 | { | 129 | { |
114 | int ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); | 130 | int ret; |
131 | |||
132 | might_sleep(); | ||
133 | |||
134 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); | ||
115 | trace_drv_set_key(local, cmd, sdata, sta, key, ret); | 135 | trace_drv_set_key(local, cmd, sdata, sta, key, ret); |
116 | return ret; | 136 | return ret; |
117 | } | 137 | } |
@@ -121,6 +141,8 @@ static inline void drv_update_tkip_key(struct ieee80211_local *local, | |||
121 | const u8 *address, u32 iv32, | 141 | const u8 *address, u32 iv32, |
122 | u16 *phase1key) | 142 | u16 *phase1key) |
123 | { | 143 | { |
144 | might_sleep(); | ||
145 | |||
124 | if (local->ops->update_tkip_key) | 146 | if (local->ops->update_tkip_key) |
125 | local->ops->update_tkip_key(&local->hw, conf, address, | 147 | local->ops->update_tkip_key(&local->hw, conf, address, |
126 | iv32, phase1key); | 148 | iv32, phase1key); |
@@ -130,13 +152,19 @@ static inline void drv_update_tkip_key(struct ieee80211_local *local, | |||
130 | static inline int drv_hw_scan(struct ieee80211_local *local, | 152 | static inline int drv_hw_scan(struct ieee80211_local *local, |
131 | struct cfg80211_scan_request *req) | 153 | struct cfg80211_scan_request *req) |
132 | { | 154 | { |
133 | int ret = local->ops->hw_scan(&local->hw, req); | 155 | int ret; |
156 | |||
157 | might_sleep(); | ||
158 | |||
159 | ret = local->ops->hw_scan(&local->hw, req); | ||
134 | trace_drv_hw_scan(local, req, ret); | 160 | trace_drv_hw_scan(local, req, ret); |
135 | return ret; | 161 | return ret; |
136 | } | 162 | } |
137 | 163 | ||
138 | static inline void drv_sw_scan_start(struct ieee80211_local *local) | 164 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
139 | { | 165 | { |
166 | might_sleep(); | ||
167 | |||
140 | if (local->ops->sw_scan_start) | 168 | if (local->ops->sw_scan_start) |
141 | local->ops->sw_scan_start(&local->hw); | 169 | local->ops->sw_scan_start(&local->hw); |
142 | trace_drv_sw_scan_start(local); | 170 | trace_drv_sw_scan_start(local); |
@@ -144,6 +172,8 @@ static inline void drv_sw_scan_start(struct ieee80211_local *local) | |||
144 | 172 | ||
145 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) | 173 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) |
146 | { | 174 | { |
175 | might_sleep(); | ||
176 | |||
147 | if (local->ops->sw_scan_complete) | 177 | if (local->ops->sw_scan_complete) |
148 | local->ops->sw_scan_complete(&local->hw); | 178 | local->ops->sw_scan_complete(&local->hw); |
149 | trace_drv_sw_scan_complete(local); | 179 | trace_drv_sw_scan_complete(local); |
@@ -154,6 +184,8 @@ static inline int drv_get_stats(struct ieee80211_local *local, | |||
154 | { | 184 | { |
155 | int ret = -EOPNOTSUPP; | 185 | int ret = -EOPNOTSUPP; |
156 | 186 | ||
187 | might_sleep(); | ||
188 | |||
157 | if (local->ops->get_stats) | 189 | if (local->ops->get_stats) |
158 | ret = local->ops->get_stats(&local->hw, stats); | 190 | ret = local->ops->get_stats(&local->hw, stats); |
159 | trace_drv_get_stats(local, stats, ret); | 191 | trace_drv_get_stats(local, stats, ret); |
@@ -173,6 +205,9 @@ static inline int drv_set_rts_threshold(struct ieee80211_local *local, | |||
173 | u32 value) | 205 | u32 value) |
174 | { | 206 | { |
175 | int ret = 0; | 207 | int ret = 0; |
208 | |||
209 | might_sleep(); | ||
210 | |||
176 | if (local->ops->set_rts_threshold) | 211 | if (local->ops->set_rts_threshold) |
177 | ret = local->ops->set_rts_threshold(&local->hw, value); | 212 | ret = local->ops->set_rts_threshold(&local->hw, value); |
178 | trace_drv_set_rts_threshold(local, value, ret); | 213 | trace_drv_set_rts_threshold(local, value, ret); |
@@ -193,6 +228,9 @@ static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, | |||
193 | const struct ieee80211_tx_queue_params *params) | 228 | const struct ieee80211_tx_queue_params *params) |
194 | { | 229 | { |
195 | int ret = -EOPNOTSUPP; | 230 | int ret = -EOPNOTSUPP; |
231 | |||
232 | might_sleep(); | ||
233 | |||
196 | if (local->ops->conf_tx) | 234 | if (local->ops->conf_tx) |
197 | ret = local->ops->conf_tx(&local->hw, queue, params); | 235 | ret = local->ops->conf_tx(&local->hw, queue, params); |
198 | trace_drv_conf_tx(local, queue, params, ret); | 236 | trace_drv_conf_tx(local, queue, params, ret); |
@@ -210,6 +248,9 @@ static inline int drv_get_tx_stats(struct ieee80211_local *local, | |||
210 | static inline u64 drv_get_tsf(struct ieee80211_local *local) | 248 | static inline u64 drv_get_tsf(struct ieee80211_local *local) |
211 | { | 249 | { |
212 | u64 ret = -1ULL; | 250 | u64 ret = -1ULL; |
251 | |||
252 | might_sleep(); | ||
253 | |||
213 | if (local->ops->get_tsf) | 254 | if (local->ops->get_tsf) |
214 | ret = local->ops->get_tsf(&local->hw); | 255 | ret = local->ops->get_tsf(&local->hw); |
215 | trace_drv_get_tsf(local, ret); | 256 | trace_drv_get_tsf(local, ret); |
@@ -218,6 +259,8 @@ static inline u64 drv_get_tsf(struct ieee80211_local *local) | |||
218 | 259 | ||
219 | static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) | 260 | static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) |
220 | { | 261 | { |
262 | might_sleep(); | ||
263 | |||
221 | if (local->ops->set_tsf) | 264 | if (local->ops->set_tsf) |
222 | local->ops->set_tsf(&local->hw, tsf); | 265 | local->ops->set_tsf(&local->hw, tsf); |
223 | trace_drv_set_tsf(local, tsf); | 266 | trace_drv_set_tsf(local, tsf); |
@@ -225,6 +268,8 @@ static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) | |||
225 | 268 | ||
226 | static inline void drv_reset_tsf(struct ieee80211_local *local) | 269 | static inline void drv_reset_tsf(struct ieee80211_local *local) |
227 | { | 270 | { |
271 | might_sleep(); | ||
272 | |||
228 | if (local->ops->reset_tsf) | 273 | if (local->ops->reset_tsf) |
229 | local->ops->reset_tsf(&local->hw); | 274 | local->ops->reset_tsf(&local->hw); |
230 | trace_drv_reset_tsf(local); | 275 | trace_drv_reset_tsf(local); |
@@ -233,6 +278,9 @@ static inline void drv_reset_tsf(struct ieee80211_local *local) | |||
233 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | 278 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) |
234 | { | 279 | { |
235 | int ret = 1; | 280 | int ret = 1; |
281 | |||
282 | might_sleep(); | ||
283 | |||
236 | if (local->ops->tx_last_beacon) | 284 | if (local->ops->tx_last_beacon) |
237 | ret = local->ops->tx_last_beacon(&local->hw); | 285 | ret = local->ops->tx_last_beacon(&local->hw); |
238 | trace_drv_tx_last_beacon(local, ret); | 286 | trace_drv_tx_last_beacon(local, ret); |
@@ -256,12 +304,16 @@ static inline int drv_ampdu_action(struct ieee80211_local *local, | |||
256 | 304 | ||
257 | static inline void drv_rfkill_poll(struct ieee80211_local *local) | 305 | static inline void drv_rfkill_poll(struct ieee80211_local *local) |
258 | { | 306 | { |
307 | might_sleep(); | ||
308 | |||
259 | if (local->ops->rfkill_poll) | 309 | if (local->ops->rfkill_poll) |
260 | local->ops->rfkill_poll(&local->hw); | 310 | local->ops->rfkill_poll(&local->hw); |
261 | } | 311 | } |
262 | 312 | ||
263 | static inline void drv_flush(struct ieee80211_local *local, bool drop) | 313 | static inline void drv_flush(struct ieee80211_local *local, bool drop) |
264 | { | 314 | { |
315 | might_sleep(); | ||
316 | |||
265 | trace_drv_flush(local, drop); | 317 | trace_drv_flush(local, drop); |
266 | if (local->ops->flush) | 318 | if (local->ops->flush) |
267 | local->ops->flush(&local->hw, drop); | 319 | local->ops->flush(&local->hw, drop); |