Commit 2fe3e8e7 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Greg Kroah-Hartman

staging: ks7010: fix wait_for_completion_interruptible_timeout return handling

commit 9d29f14d upstream.

wait_for_completion_interruptible_timeout return 0 on timeout and
-ERESTARTSYS if interrupted. The check for
!wait_for_completion_interruptible_timeout() would report an interrupt
as timeout. Further, while HZ/50 will work most of the time it could
fail for HZ < 50, so this is switched to msecs_to_jiffies(20).

Fixes: 13a9930d ("staging: ks7010: add driver from Nanonote extra-repository")
Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7da89c6a
...@@ -74,11 +74,15 @@ void ks_wlan_hw_wakeup_task(struct work_struct *work) ...@@ -74,11 +74,15 @@ void ks_wlan_hw_wakeup_task(struct work_struct *work)
struct ks_wlan_private *priv = struct ks_wlan_private *priv =
container_of(work, struct ks_wlan_private, ks_wlan_wakeup_task); container_of(work, struct ks_wlan_private, ks_wlan_wakeup_task);
int ps_status = atomic_read(&priv->psstatus.status); int ps_status = atomic_read(&priv->psstatus.status);
long time_left;
if (ps_status == PS_SNOOZE) { if (ps_status == PS_SNOOZE) {
ks_wlan_hw_wakeup_request(priv); ks_wlan_hw_wakeup_request(priv);
if (!wait_for_completion_interruptible_timeout(&priv->psstatus.wakeup_wait, HZ / 50)) { /* 20ms timeout */ time_left = wait_for_completion_interruptible_timeout(
DPRINTK(1, "wake up timeout !!!\n"); &priv->psstatus.wakeup_wait,
msecs_to_jiffies(20));
if (time_left <= 0) {
DPRINTK(1, "wake up timeout or interrupted !!!\n");
schedule_work(&priv->ks_wlan_wakeup_task); schedule_work(&priv->ks_wlan_wakeup_task);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment