Skip to content

Commit

Permalink
wlcore: android: don't suspend on pending recovery (INTERNAL)
Browse files Browse the repository at this point in the history
Some customers complain that if we cancel a pending recovery during
suspend, the android scheduler will keep banging on the suspend handler,
without letting recovery take its course. Grab a wakelock to give the
recovery process some breathing room.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
  • Loading branch information
ariknem committed Jul 15, 2012
1 parent 0858c6e commit b94686e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/wireless/ti/wlcore/main.c
Expand Up @@ -783,6 +783,10 @@ void wl12xx_queue_recovery_work(struct wl1271 *wl)
/* Avoid a recursive recovery */ /* Avoid a recursive recovery */
if (!test_and_set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { if (!test_and_set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) {
wlcore_disable_interrupts_nosync(wl); wlcore_disable_interrupts_nosync(wl);
#ifdef CONFIG_HAS_WAKELOCK
/* give us a grace period for recovery */
wake_lock_timeout(&wl->recovery_wake, 5 * HZ);
#endif
ieee80211_queue_work(wl->hw, &wl->recovery_work); ieee80211_queue_work(wl->hw, &wl->recovery_work);
} }
} }
Expand Down Expand Up @@ -1717,6 +1721,10 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
/* we want to perform the recovery before suspending */ /* we want to perform the recovery before suspending */
if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) {
wl1271_warning("postponing suspend to perform recovery"); wl1271_warning("postponing suspend to perform recovery");
#ifdef CONFIG_HAS_WAKELOCK
/* give us a grace period for recovery */
wake_lock_timeout(&wl->recovery_wake, 5 * HZ);
#endif
return -EBUSY; return -EBUSY;
} }


Expand Down Expand Up @@ -5433,6 +5441,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
#ifdef CONFIG_HAS_WAKELOCK #ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&wl->wake_lock, WAKE_LOCK_SUSPEND, "wl1271_wake"); wake_lock_init(&wl->wake_lock, WAKE_LOCK_SUSPEND, "wl1271_wake");
wake_lock_init(&wl->rx_wake, WAKE_LOCK_SUSPEND, "rx_wake"); wake_lock_init(&wl->rx_wake, WAKE_LOCK_SUSPEND, "rx_wake");
wake_lock_init(&wl->recovery_wake, WAKE_LOCK_SUSPEND, "recovery_wake");
#endif #endif


wl->state = WL1271_STATE_OFF; wl->state = WL1271_STATE_OFF;
Expand Down Expand Up @@ -5498,6 +5507,7 @@ int wlcore_free_hw(struct wl1271 *wl)
#ifdef CONFIG_HAS_WAKELOCK #ifdef CONFIG_HAS_WAKELOCK
wake_lock_destroy(&wl->wake_lock); wake_lock_destroy(&wl->wake_lock);
wake_lock_destroy(&wl->rx_wake); wake_lock_destroy(&wl->rx_wake);
wake_lock_destroy(&wl->recovery_wake);
#endif #endif
/* Unblock any fwlog readers */ /* Unblock any fwlog readers */
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ti/wlcore/wlcore.h
Expand Up @@ -296,6 +296,7 @@ struct wl1271 {
#ifdef CONFIG_HAS_WAKELOCK #ifdef CONFIG_HAS_WAKELOCK
struct wake_lock wake_lock; struct wake_lock wake_lock;
struct wake_lock rx_wake; struct wake_lock rx_wake;
struct wake_lock recovery_wake;
#endif #endif
struct wl1271_stats stats; struct wl1271_stats stats;


Expand Down

0 comments on commit b94686e

Please sign in to comment.