Commit 596a1b746c56f974240c8df6d8e3a026c54266ff
Exists in
master
and in
6 other branches
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Showing 4 changed files Side-by-side Diff
drivers/net/wireless/libertas/if_spi.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
... | ... | @@ -465,6 +465,23 @@ |
465 | 465 | return NULL; |
466 | 466 | } |
467 | 467 | |
468 | +static void rt2x00lib_sleep(struct work_struct *work) | |
469 | +{ | |
470 | + struct rt2x00_dev *rt2x00dev = | |
471 | + container_of(work, struct rt2x00_dev, sleep_work); | |
472 | + | |
473 | + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | |
474 | + return; | |
475 | + | |
476 | + /* | |
477 | + * Check again is powersaving is enabled, to prevent races from delayed | |
478 | + * work execution. | |
479 | + */ | |
480 | + if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) | |
481 | + rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, | |
482 | + IEEE80211_CONF_CHANGE_PS); | |
483 | +} | |
484 | + | |
468 | 485 | static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, |
469 | 486 | struct sk_buff *skb, |
470 | 487 | struct rxdone_entry_desc *rxdesc) |
... | ... | @@ -512,8 +529,7 @@ |
512 | 529 | cam |= (tim_ie->bitmap_ctrl & 0x01); |
513 | 530 | |
514 | 531 | if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) |
515 | - rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, | |
516 | - IEEE80211_CONF_CHANGE_PS); | |
532 | + queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work); | |
517 | 533 | } |
518 | 534 | |
519 | 535 | static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, |
... | ... | @@ -1141,6 +1157,7 @@ |
1141 | 1157 | |
1142 | 1158 | INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); |
1143 | 1159 | INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); |
1160 | + INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); | |
1144 | 1161 | |
1145 | 1162 | /* |
1146 | 1163 | * Let the driver probe the device to detect the capabilities. |
... | ... | @@ -1197,6 +1214,7 @@ |
1197 | 1214 | */ |
1198 | 1215 | cancel_work_sync(&rt2x00dev->intf_work); |
1199 | 1216 | cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); |
1217 | + cancel_work_sync(&rt2x00dev->sleep_work); | |
1200 | 1218 | if (rt2x00_is_usb(rt2x00dev)) { |
1201 | 1219 | del_timer_sync(&rt2x00dev->txstatus_timer); |
1202 | 1220 | cancel_work_sync(&rt2x00dev->rxdone_work); |