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
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.
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. ;)
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:
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.
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>
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(-)
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
49 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
50 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
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
60 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
61 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
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;
71 - if (!test_bit(DEVICE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags))
72 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags))
76 --- a/drivers/net/wireless/rt2x00/rt2x00.h
77 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
78 @@ -599,14 +599,14 @@ enum rt2x00_flags {
83 - DEVICE_REGISTERED_HW,
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,
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.
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);
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;
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);
121 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
122 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
125 void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev)
127 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
128 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
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.
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))
143 @@ -117,7 +117,7 @@ int rt2x00lib_enable_radio(struct rt2x00
144 rt2x00leds_led_radio(rt2x00dev, true);
145 rt2x00led_led_activity(rt2x00dev, true);
147 - __set_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags);
148 + set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags);
152 @@ -134,7 +134,7 @@ int rt2x00lib_enable_radio(struct rt2x00
154 void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
156 - if (!__test_and_clear_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
157 + if (!test_and_clear_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
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.
165 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
166 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
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.
174 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
175 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
178 if (delayed_flags & DELAYED_UPDATE_BEACON)
179 @@ -484,7 +484,7 @@ static void rt2x00lib_beacondone_iter(vo
181 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
183 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
184 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
187 ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw,
188 @@ -563,7 +563,7 @@ void rt2x00lib_txdone(struct queue_entry
190 rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry);
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);
197 @@ -878,7 +878,7 @@ static int rt2x00lib_probe_hw_modes(stru
199 static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev)
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);
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;
210 + if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags))
214 * Initialize HW modes.
216 @@ -915,7 +918,7 @@ static int rt2x00lib_probe_hw(struct rt2
220 - __set_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags);
221 + set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags);
225 @@ -925,7 +928,7 @@ static int rt2x00lib_probe_hw(struct rt2
227 static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
229 - if (!__test_and_clear_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
230 + if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags))
234 @@ -948,7 +951,7 @@ static int rt2x00lib_initialize(struct r
238 - if (test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
239 + if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags))
243 @@ -967,7 +970,7 @@ static int rt2x00lib_initialize(struct r
247 - __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
248 + set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
251 * Register the extra components.
252 @@ -981,7 +984,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
256 - if (test_bit(DEVICE_STARTED, &rt2x00dev->flags))
257 + if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
261 @@ -1012,15 +1015,15 @@ int rt2x00lib_start(struct rt2x00_dev *r
262 rt2x00dev->intf_sta_count = 0;
263 rt2x00dev->intf_associated = 0;
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);
273 void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev)
275 - if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
276 + if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
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;
285 - __clear_bit(DEVICE_STARTED, &rt2x00dev->flags);
289 @@ -1088,7 +1089,7 @@ int rt2x00lib_probe_dev(struct rt2x00_de
290 rt2x00rfkill_allocate(rt2x00dev);
291 rt2x00debug_register(rt2x00dev);
293 - __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
294 + set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
298 @@ -1101,7 +1102,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev);
300 void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
302 - __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags);
303 + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
307 @@ -1146,14 +1147,15 @@ int rt2x00lib_suspend(struct rt2x00_dev
310 NOTICE(rt2x00dev, "Going to sleep.\n");
311 - __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags);
314 * Only continue if mac80211 has open interfaces.
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))
320 - __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags);
322 + set_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags);
326 @@ -1225,7 +1227,7 @@ int rt2x00lib_resume(struct rt2x00_dev *
328 * Only continue if mac80211 had open interfaces.
330 - if (!__test_and_clear_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags))
331 + if (!test_and_clear_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags))
335 @@ -1252,7 +1254,7 @@ int rt2x00lib_resume(struct rt2x00_dev *
337 * We are ready again to receive requests from mac80211.
339 - __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
340 + set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
343 * It is possible that during that mac80211 has attempted
344 @@ -1272,7 +1274,7 @@ int rt2x00lib_resume(struct rt2x00_dev *
348 - rt2x00lib_disable_radio(rt2x00dev);
349 + rt2x00lib_stop(rt2x00dev);
350 rt2x00lib_uninitialize(rt2x00dev);
351 rt2x00debug_deregister(rt2x00dev);
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.
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);
364 @@ -168,7 +168,7 @@ int rt2x00mac_start(struct ieee80211_hw
366 struct rt2x00_dev *rt2x00dev = hw->priv;
368 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
369 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
372 return rt2x00lib_start(rt2x00dev);
373 @@ -179,7 +179,7 @@ void rt2x00mac_stop(struct ieee80211_hw
375 struct rt2x00_dev *rt2x00dev = hw->priv;
377 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
378 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
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.
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))
392 switch (conf->type) {
393 @@ -249,7 +249,7 @@ int rt2x00mac_add_interface(struct ieee8
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))
402 @@ -303,7 +303,7 @@ void rt2x00mac_remove_interface(struct i
403 * either the device has disappeared or when
404 * no interface is present.
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))
411 @@ -317,7 +317,7 @@ void rt2x00mac_remove_interface(struct i
412 * Release beacon entry so it is available for
413 * new interfaces again.
415 - __clear_bit(ENTRY_BCN_ASSIGNED, &intf->beacon->flags);
416 + clear_bit(ENTRY_BCN_ASSIGNED, &intf->beacon->flags);
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.
424 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
425 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
429 * Check if we need to disable the radio,
430 * if this is not the case, at least the RX must be disabled.
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);
437 @@ -359,14 +359,14 @@ int rt2x00mac_config(struct ieee80211_hw
441 - __test_and_clear_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
442 + test_and_clear_bit(DEVICE_STATE_DIRTY_CONFIG, &rt2x00dev->flags);
444 rt2x00lib_config(rt2x00dev, conf, force_reconfig);
447 * Reenable RX only if the radio should be on.
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.
458 - if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
459 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
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)))
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;
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);
483 if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
484 rt2x00queue_map_txskb(queue->rt2x00dev, skb);
486 - __set_bit(ENTRY_DATA_PENDING, &entry->flags);
487 + set_bit(ENTRY_DATA_PENDING, &entry->flags);
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
495 * Only continue if there are enabled interfaces.
497 - if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
498 + if (!test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
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);
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;
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))
524 @@ -232,7 +232,7 @@ static inline void rt2x00usb_kick_tx_ent
526 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
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);
533 @@ -283,7 +283,7 @@ static void rt2x00usb_interrupt_rxdone(s
534 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
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))
542 @@ -293,7 +293,7 @@ static void rt2x00usb_interrupt_rxdone(s
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);
551 @@ -361,7 +361,7 @@ void rt2x00usb_init_rxentry(struct rt2x0
552 entry->skb->data, entry->skb->len,
553 rt2x00usb_interrupt_rxdone, entry);
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);
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)
566 - if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
567 + if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))