]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/rt2x00-fix-race-conditions.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / rt2x00-fix-race-conditions.patch
1 From 0262ab0df64a67d4c0ed7577a29b7d866819cc68 Mon Sep 17 00:00:00 2001
2 From: Ivo van Doorn <ivdoorn@gmail.com>
3 Date: Fri, 29 Aug 2008 21:04:26 +0200
4 Subject: [PATCH] rt2x00: Fix race conditions in flag handling
5 Patch-mainline: 2.6.28-rc3
6 References: bnc#462551
7
8 Some of the flags should be accessed atomically to
9 prevent race conditions. The flags that are most important
10 are those that can change often and indicate the actual
11 state of the device, queue or queue entry.
12
13 The big flag rename was done to move all state flags to
14 the same naming type as the other rt2x00dev flags and
15 made sure all places where the flags were used were changed. ;)
16
17 Thanks to Stephen for most of the queue flags updates,
18 which fixes some of the most obvious consequences of the
19 race conditions. Among those the notorious:
20
21 rt2x00queue_write_tx_frame: Error - Arrived at non-free entry in the non-full queue 0.
22 rt2x00queue_write_tx_frame: Error - Arrived at non-free entry in the non-full queue 0.
23 rt2x00queue_write_tx_frame: Error - Arrived at non-free entry in the non-full queue 0.
24
25 Signed-off-by: Stephen Blackheath <tramp.enshrine.stephen@blacksapphire.com>
26 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
27 Signed-off-by: John W. Linville <linville@tuxdriver.com>
28 Signed-off-by: Jiri Slaby <jslaby@suse.cz>
29 ---
30 drivers/net/wireless/rt2x00/rt2400pci.c | 2 -
31 drivers/net/wireless/rt2x00/rt2500pci.c | 2 -
32 drivers/net/wireless/rt2x00/rt2500usb.c | 2 -
33 drivers/net/wireless/rt2x00/rt2x00.h | 16 ++++----
34 drivers/net/wireless/rt2x00/rt2x00config.c | 4 +-
35 drivers/net/wireless/rt2x00/rt2x00dev.c | 58 +++++++++++++++--------------
36 drivers/net/wireless/rt2x00/rt2x00mac.c | 26 ++++++-------
37 drivers/net/wireless/rt2x00/rt2x00queue.c | 6 +--
38 drivers/net/wireless/rt2x00/rt2x00rfkill.c | 6 +--
39 drivers/net/wireless/rt2x00/rt2x00usb.c | 10 ++---
40 drivers/net/wireless/rt2x00/rt61pci.c | 2 -
41 11 files changed, 68 insertions(+), 66 deletions(-)
42
43 --- a/drivers/net/wireless/rt2x00/rt2400pci.c
44 +++ b/drivers/net/wireless/rt2x00/rt2400pci.c
45 @@ -1241,7 +1241,7 @@ static irqreturn_t rt2400pci_interrupt(i
46 if (!reg)
47 return IRQ_NONE;
48
49 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
50 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
51 return IRQ_HANDLED;
52
53 /*
54 --- a/drivers/net/wireless/rt2x00/rt2500pci.c
55 +++ b/drivers/net/wireless/rt2x00/rt2500pci.c
56 @@ -1377,7 +1377,7 @@ static irqreturn_t rt2500pci_interrupt(i
57 if (!reg)
58 return IRQ_NONE;
59
60 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
61 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
62 return IRQ_HANDLED;
63
64 /*
65 --- a/drivers/net/wireless/rt2x00/rt2500usb.c
66 +++ b/drivers/net/wireless/rt2x00/rt2500usb.c
67 @@ -1297,7 +1297,7 @@ static void rt2500usb_beacondone(struct
68 struct queue_entry *entry = (struct queue_entry *)urb->context;
69 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data;
70
71 - if (!test_bit(DEVICE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags))
72 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags))
73 return;
74
75 /*
76 --- a/drivers/net/wireless/rt2x00/rt2x00.h
77 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
78 @@ -599,14 +599,14 @@ enum rt2x00_flags {
79 /*
80 * Device state flags
81 */
82 - DEVICE_PRESENT,
83 - DEVICE_REGISTERED_HW,
84 - DEVICE_INITIALIZED,
85 - DEVICE_STARTED,
86 - DEVICE_STARTED_SUSPEND,
87 - DEVICE_ENABLED_RADIO,
88 - DEVICE_DISABLED_RADIO_HW,
89 - DEVICE_DIRTY_CONFIG,
90 + DEVICE_STATE_PRESENT,
91 + DEVICE_STATE_REGISTERED_HW,
92 + DEVICE_STATE_INITIALIZED,
93 + DEVICE_STATE_STARTED,
94 + DEVICE_STATE_STARTED_SUSPEND,
95 + DEVICE_STATE_ENABLED_RADIO,
96 + DEVICE_STATE_DISABLED_RADIO_HW,
97 + DEVICE_STATE_DIRTY_CONFIG,
98
99 /*
100 * Driver features
101 --- a/drivers/net/wireless/rt2x00/rt2x00config.c
102 +++ b/drivers/net/wireless/rt2x00/rt2x00config.c
103 @@ -121,7 +121,7 @@ void rt2x00lib_config_antenna(struct rt2
104 * Antenna setup changes require the RX to be disabled,
105 * else the changes will be ignored by the device.
106 */
107 - if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
108 + if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
109 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
110
111 /*
112 @@ -136,7 +136,7 @@ void rt2x00lib_config_antenna(struct rt2
113 rt2x00dev->link.ant.active.rx = libconf.ant.rx;
114 rt2x00dev->link.ant.active.tx = libconf.ant.tx;
115
116 - if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
117 + if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
118 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
119 }
120
121 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
122 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
123 @@ -34,7 +34,7 @@
124 */
125 void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev)
126 {
127 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
128 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
129 return;
130
131 /*
132 @@ -94,8 +94,8 @@ int rt2x00lib_enable_radio(struct rt2x00
133 * Don't enable the radio twice.
134 * And check if the hardware button has been disabled.
135 */
136 - if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
137 - test_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags))
138 + if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) ||
139 + test_bit(DEVICE_STATE_DISABLED_RADIO_HW, &rt2x00dev->flags))
140 return 0;
141
142 /*
143 @@ -117,7 +117,7 @@ int rt2x00lib_enable_radio(struct rt2x00
144 rt2x00leds_led_radio(rt2x00dev, true);
145 rt2x00led_led_activity(rt2x00dev, true);
146
147 - __set_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags);
148 + set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags);
149
150 /*
151 * Enable RX.
152 @@ -134,7 +134,7 @@ int rt2x00lib_enable_radio(struct rt2x00
153
154 void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
155 {
156 - if (!__test_and_clear_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
157 + if (!test_and_clear_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
158 return;
159
160 /*
161 @@ -354,7 +354,7 @@ static void rt2x00lib_link_tuner(struct
162 * When the radio is shutting down we should
163 * immediately cease all link tuning.
164 */
165 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
166 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
167 return;
168
169 /*
170 @@ -431,7 +431,7 @@ static void rt2x00lib_intf_scheduled_ite
171 * note that in the spinlock protected area above the delayed_flags
172 * have been cleared correctly.
173 */
174 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
175 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
176 return;
177
178 if (delayed_flags & DELAYED_UPDATE_BEACON)
179 @@ -484,7 +484,7 @@ static void rt2x00lib_beacondone_iter(vo
180
181 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
182 {
183 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
184 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
185 return;
186
187 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw,
188 @@ -563,7 +563,7 @@ void rt2x00lib_txdone(struct queue_entry
189
190 rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry);
191
192 - __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
193 + clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
194 rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE);
195
196 /*
197 @@ -878,7 +878,7 @@ static int rt2x00lib_probe_hw_modes(stru
198
199 static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev)
200 {
201 - if (test_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags))
202 + if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags))
203 ieee80211_unregister_hw(rt2x00dev->hw);
204
205 if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) {
206 @@ -894,6 +894,9 @@ static int rt2x00lib_probe_hw(struct rt2
207 struct hw_mode_spec *spec = &rt2x00dev->spec;
208 int status;
209
210 + if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags))
211 + return 0;
212 +
213 /*
214 * Initialize HW modes.
215 */
216 @@ -915,7 +918,7 @@ static int rt2x00lib_probe_hw(struct rt2
217 return status;
218 }
219
220 - __set_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags);
221 + set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags);
222
223 return 0;
224 }
225 @@ -925,7 +928,7 @@ static int rt2x00lib_probe_hw(struct rt2
226 */
227 static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
228 {
229 - if (!__test_and_clear_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
230 + if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags))
231 return;
232
233 /*
234 @@ -948,7 +951,7 @@ static int rt2x00lib_initialize(struct r
235 {
236 int status;
237
238 - if (test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
239 + if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags))
240 return 0;
241
242 /*
243 @@ -967,7 +970,7 @@ static int rt2x00lib_initialize(struct r
244 return status;
245 }
246
247 - __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
248 + set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
249
250 /*
251 * Register the extra components.
252 @@ -981,7 +984,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
253 {
254 int retval;
255
256 - if (test_bit(DEVICE_STARTED, &rt2x00dev->flags))
257 + if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
258 return 0;
259
260 /*
261 @@ -1012,15 +1015,15 @@ int rt2x00lib_start(struct rt2x00_dev *r
262 rt2x00dev->intf_sta_count = 0;
263 rt2x00dev->intf_associated = 0;
264
265 - __set_bit(DEVICE_STARTED, &rt2x00dev->flags);
266 - __set_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
267 + set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags);
268 + set_bit(DEVICE_STATE_DIRTY_CONFIG, &rt2x00dev->flags);
269
270 return 0;
271 }
272
273 void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev)
274 {
275 - if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
276 + if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
277 return;
278
279 /*
280 @@ -1032,8 +1035,6 @@ void rt2x00lib_stop(struct rt2x00_dev *r
281 rt2x00dev->intf_ap_count = 0;
282 rt2x00dev->intf_sta_count = 0;
283 rt2x00dev->intf_associated = 0;
284 -
285 - __clear_bit(DEVICE_STARTED, &rt2x00dev->flags);
286 }
287
288 /*
289 @@ -1088,7 +1089,7 @@ int rt2x00lib_probe_dev(struct rt2x00_de
290 rt2x00rfkill_allocate(rt2x00dev);
291 rt2x00debug_register(rt2x00dev);
292
293 - __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
294 + set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
295
296 return 0;
297
298 @@ -1101,7 +1102,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev);
299
300 void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
301 {
302 - __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags);
303 + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
304
305 /*
306 * Disable radio.
307 @@ -1146,14 +1147,15 @@ int rt2x00lib_suspend(struct rt2x00_dev
308 int retval;
309
310 NOTICE(rt2x00dev, "Going to sleep.\n");
311 - __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags);
312
313 /*
314 * Only continue if mac80211 has open interfaces.
315 */
316 - if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
317 + if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
318 + !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
319 goto exit;
320 - __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags);
321 +
322 + set_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags);
323
324 /*
325 * Disable radio.
326 @@ -1225,7 +1227,7 @@ int rt2x00lib_resume(struct rt2x00_dev *
327 /*
328 * Only continue if mac80211 had open interfaces.
329 */
330 - if (!__test_and_clear_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags))
331 + if (!test_and_clear_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags))
332 return 0;
333
334 /*
335 @@ -1252,7 +1254,7 @@ int rt2x00lib_resume(struct rt2x00_dev *
336 /*
337 * We are ready again to receive requests from mac80211.
338 */
339 - __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
340 + set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
341
342 /*
343 * It is possible that during that mac80211 has attempted
344 @@ -1272,7 +1274,7 @@ int rt2x00lib_resume(struct rt2x00_dev *
345 return 0;
346
347 exit:
348 - rt2x00lib_disable_radio(rt2x00dev);
349 + rt2x00lib_stop(rt2x00dev);
350 rt2x00lib_uninitialize(rt2x00dev);
351 rt2x00debug_deregister(rt2x00dev);
352
353 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
354 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
355 @@ -106,7 +106,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw
356 * Note that we can only stop the TX queues inside the TX path
357 * due to possible race conditions in mac80211.
358 */
359 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) {
360 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) {
361 ieee80211_stop_queues(hw);
362 dev_kfree_skb_any(skb);
363 return NETDEV_TX_OK;
364 @@ -168,7 +168,7 @@ int rt2x00mac_start(struct ieee80211_hw
365 {
366 struct rt2x00_dev *rt2x00dev = hw->priv;
367
368 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
369 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
370 return 0;
371
372 return rt2x00lib_start(rt2x00dev);
373 @@ -179,7 +179,7 @@ void rt2x00mac_stop(struct ieee80211_hw
374 {
375 struct rt2x00_dev *rt2x00dev = hw->priv;
376
377 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
378 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
379 return;
380
381 rt2x00lib_stop(rt2x00dev);
382 @@ -199,8 +199,8 @@ int rt2x00mac_add_interface(struct ieee8
383 * Don't allow interfaces to be added
384 * the device has disappeared.
385 */
386 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
387 - !test_bit(DEVICE_STARTED, &rt2x00dev->flags))
388 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
389 + !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
390 return -ENODEV;
391
392 switch (conf->type) {
393 @@ -249,7 +249,7 @@ int rt2x00mac_add_interface(struct ieee8
394 */
395 for (i = 0; i < queue->limit; i++) {
396 entry = &queue->entries[i];
397 - if (!__test_and_set_bit(ENTRY_BCN_ASSIGNED, &entry->flags))
398 + if (!test_and_set_bit(ENTRY_BCN_ASSIGNED, &entry->flags))
399 break;
400 }
401
402 @@ -303,7 +303,7 @@ void rt2x00mac_remove_interface(struct i
403 * either the device has disappeared or when
404 * no interface is present.
405 */
406 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
407 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
408 (conf->type == IEEE80211_IF_TYPE_AP && !rt2x00dev->intf_ap_count) ||
409 (conf->type != IEEE80211_IF_TYPE_AP && !rt2x00dev->intf_sta_count))
410 return;
411 @@ -317,7 +317,7 @@ void rt2x00mac_remove_interface(struct i
412 * Release beacon entry so it is available for
413 * new interfaces again.
414 */
415 - __clear_bit(ENTRY_BCN_ASSIGNED, &intf->beacon->flags);
416 + clear_bit(ENTRY_BCN_ASSIGNED, &intf->beacon->flags);
417
418 /*
419 * Make sure the bssid and mac address registers
420 @@ -337,14 +337,14 @@ int rt2x00mac_config(struct ieee80211_hw
421 * Mac80211 might be calling this function while we are trying
422 * to remove the device or perhaps suspending it.
423 */
424 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
425 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
426 return 0;
427
428 /*
429 * Check if we need to disable the radio,
430 * if this is not the case, at least the RX must be disabled.
431 */
432 - if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) {
433 + if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) {
434 if (!conf->radio_enabled)
435 rt2x00lib_disable_radio(rt2x00dev);
436 else
437 @@ -359,14 +359,14 @@ int rt2x00mac_config(struct ieee80211_hw
438 * initialized.
439 */
440 force_reconfig =
441 - __test_and_clear_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
442 + test_and_clear_bit(DEVICE_STATE_DIRTY_CONFIG, &rt2x00dev->flags);
443
444 rt2x00lib_config(rt2x00dev, conf, force_reconfig);
445
446 /*
447 * Reenable RX only if the radio should be on.
448 */
449 - if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
450 + if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
451 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
452 else if (conf->radio_enabled)
453 return rt2x00lib_enable_radio(rt2x00dev);
454 @@ -388,7 +388,7 @@ int rt2x00mac_config_interface(struct ie
455 * Mac80211 might be calling this function while we are trying
456 * to remove the device or perhaps suspending it.
457 */
458 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
459 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
460 return 0;
461
462 spin_lock(&intf->lock);
463 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
464 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
465 @@ -309,7 +309,7 @@ int rt2x00queue_write_tx_frame(struct da
466 if (unlikely(rt2x00queue_full(queue)))
467 return -EINVAL;
468
469 - if (__test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) {
470 + if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) {
471 ERROR(queue->rt2x00dev,
472 "Arrived at non-free entry in the non-full queue %d.\n"
473 "Please file bug report to %s.\n",
474 @@ -333,14 +333,14 @@ int rt2x00queue_write_tx_frame(struct da
475 skbdesc->entry = entry;
476
477 if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) {
478 - __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
479 + clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
480 return -EIO;
481 }
482
483 if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
484 rt2x00queue_map_txskb(queue->rt2x00dev, skb);
485
486 - __set_bit(ENTRY_DATA_PENDING, &entry->flags);
487 + set_bit(ENTRY_DATA_PENDING, &entry->flags);
488
489 rt2x00queue_index_inc(queue, Q_INDEX);
490 rt2x00queue_write_tx_descriptor(entry, &txdesc);
491 --- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
492 +++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
493 @@ -41,16 +41,16 @@ static int rt2x00rfkill_toggle_radio(voi
494 /*
495 * Only continue if there are enabled interfaces.
496 */
497 - if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
498 + if (!test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
499 return 0;
500
501 if (state == RFKILL_STATE_UNBLOCKED) {
502 INFO(rt2x00dev, "Hardware button pressed, enabling radio.\n");
503 - __clear_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags);
504 + clear_bit(DEVICE_STATE_DISABLED_RADIO_HW, &rt2x00dev->flags);
505 retval = rt2x00lib_enable_radio(rt2x00dev);
506 } else if (state == RFKILL_STATE_SOFT_BLOCKED) {
507 INFO(rt2x00dev, "Hardware button pressed, disabling radio.\n");
508 - __set_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags);
509 + set_bit(DEVICE_STATE_DISABLED_RADIO_HW, &rt2x00dev->flags);
510 rt2x00lib_disable_radio(rt2x00dev);
511 } else {
512 WARNING(rt2x00dev, "Received unexpected rfkill state %d.\n",
513 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c
514 +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
515 @@ -163,7 +163,7 @@ static void rt2x00usb_interrupt_txdone(s
516 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
517 struct txdone_entry_desc txdesc;
518
519 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
520 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) ||
521 !test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
522 return;
523
524 @@ -232,7 +232,7 @@ static inline void rt2x00usb_kick_tx_ent
525 {
526 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
527
528 - if (__test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags))
529 + if (test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags))
530 usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
531 }
532
533 @@ -283,7 +283,7 @@ static void rt2x00usb_interrupt_rxdone(s
534 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
535 u8 rxd[32];
536
537 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
538 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) ||
539 !test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
540 return;
541
542 @@ -293,7 +293,7 @@ static void rt2x00usb_interrupt_rxdone(s
543 * a problem.
544 */
545 if (urb->actual_length < entry->queue->desc_size || urb->status) {
546 - __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
547 + set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
548 usb_submit_urb(urb, GFP_ATOMIC);
549 return;
550 }
551 @@ -361,7 +361,7 @@ void rt2x00usb_init_rxentry(struct rt2x0
552 entry->skb->data, entry->skb->len,
553 rt2x00usb_interrupt_rxdone, entry);
554
555 - __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
556 + set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
557 usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
558 }
559 EXPORT_SYMBOL_GPL(rt2x00usb_init_rxentry);
560 --- a/drivers/net/wireless/rt2x00/rt61pci.c
561 +++ b/drivers/net/wireless/rt2x00/rt61pci.c
562 @@ -1860,7 +1860,7 @@ static irqreturn_t rt61pci_interrupt(int
563 if (!reg && !reg_mcu)
564 return IRQ_NONE;
565
566 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
567 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
568 return IRQ_HANDLED;
569
570 /*