diff options
author | Grazvydas Ignotas <notasas@gmail.com> | 2011-03-06 12:23:37 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-11 14:15:35 -0500 |
commit | 5f6722ee63a45d4ad3412743d161ec54d6c32ccc (patch) | |
tree | 4eb2812a5f0dd9c6d538d74f48afee91bca06d90 /drivers/net/wireless/wl1251 | |
parent | d0c331aff99ca75f9aa0f794cf68b572d8ec7c5a (diff) |
wl1251: fix elp_work race condition
While working on PS I've noticed elp_work is kicking rather often, and
sometimes the chip is put to sleep before 5ms delay expires. This
seems to happen because by the time wl1251_ps_elp_wakeup is called
elp_work might still be pending. After wakeup is done, the processing
may take some time, during which 5ms might expire and elp_work might
get scheduled. In this case, ss soon as 1st thread finishes work and
releases the mutex, elp_work will then put the device to sleep without
5ms delay. In addition 1st thread will queue additional elp_work
needlessly.
Fix this by cancelling work in wl1251_ps_elp_wakeup instead.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl1251')
-rw-r--r-- | drivers/net/wireless/wl1251/ps.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/wireless/wl1251/ps.c b/drivers/net/wireless/wl1251/ps.c index 842155e65a80..9cc514703d2a 100644 --- a/drivers/net/wireless/wl1251/ps.c +++ b/drivers/net/wireless/wl1251/ps.c | |||
@@ -58,7 +58,6 @@ void wl1251_ps_elp_sleep(struct wl1251 *wl) | |||
58 | unsigned long delay; | 58 | unsigned long delay; |
59 | 59 | ||
60 | if (wl->psm) { | 60 | if (wl->psm) { |
61 | cancel_delayed_work(&wl->elp_work); | ||
62 | delay = msecs_to_jiffies(ELP_ENTRY_DELAY); | 61 | delay = msecs_to_jiffies(ELP_ENTRY_DELAY); |
63 | ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, delay); | 62 | ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, delay); |
64 | } | 63 | } |
@@ -69,6 +68,9 @@ int wl1251_ps_elp_wakeup(struct wl1251 *wl) | |||
69 | unsigned long timeout, start; | 68 | unsigned long timeout, start; |
70 | u32 elp_reg; | 69 | u32 elp_reg; |
71 | 70 | ||
71 | if (delayed_work_pending(&wl->elp_work)) | ||
72 | cancel_delayed_work(&wl->elp_work); | ||
73 | |||
72 | if (!wl->elp) | 74 | if (!wl->elp) |
73 | return 0; | 75 | return 0; |
74 | 76 | ||