diff options
author | Nicholas Mc Guire <hofrat@osadl.org> | 2016-07-25 21:21:50 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-21 18:12:57 +0200 |
commit | 9d29f14db1095f52ca00b8162b242d6fce07d19f (patch) | |
tree | df84ca1f815014b31c1f114d313bed144217e24c | |
parent | bda457d42771e790c2f9be0b483f749b1f22eb2c (diff) | |
download | op-kernel-dev-9d29f14db1095f52ca00b8162b242d6fce07d19f.zip op-kernel-dev-9d29f14db1095f52ca00b8162b242d6fce07d19f.tar.gz |
staging: ks7010: fix wait_for_completion_interruptible_timeout return handling
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: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/ks7010/ks_hostif.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index a8822fe..6deee46 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -74,11 +74,15 @@ void ks_wlan_hw_wakeup_task(struct work_struct *work) struct ks_wlan_private *priv = container_of(work, struct ks_wlan_private, ks_wlan_wakeup_task); int ps_status = atomic_read(&priv->psstatus.status); + long time_left; if (ps_status == PS_SNOOZE) { ks_wlan_hw_wakeup_request(priv); - if (!wait_for_completion_interruptible_timeout(&priv->psstatus.wakeup_wait, HZ / 50)) { /* 20ms timeout */ - DPRINTK(1, "wake up timeout !!!\n"); + time_left = wait_for_completion_interruptible_timeout( + &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); return; } |