summaryrefslogtreecommitdiff
path: root/drivers/usb/wusbcore/devconnect.c
diff options
context:
space:
mode:
authorThomas Pugliese <thomas.pugliese@gmail.com>2013-06-06 19:40:49 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 22:19:27 +0400
commit7d9852a88cb76b102b60b31949d5777e645f1421 (patch)
treed71cf9993bffb9b892c45ac2aef784f7bec06991 /drivers/usb/wusbcore/devconnect.c
parentd9ea21a779278da06d0cbe989594bf542ed213d7 (diff)
downloadlinux-7d9852a88cb76b102b60b31949d5777e645f1421.tar.xz
wusbcore: reduce keepalive threshold from timeout/2 to timeout/3
This patch reduces the keepalive threshold of WUSB host controllers from timeout/2 to timeout/3. The keepalive timer fires every timeout/2 ms, but due to rounding errors and jitter, the host may decide not to send a keepalive at timeout/2. By the time the next timer fires, a full timeout period may have expired causing the device to be disconnected without ever having been sent a keepalive. Changing the keepalive threshold to timeout/3 ensures that at least one keepalive will be sent before a device is disconnected. The patch also updates the code to use msecs_to_jiffies consistently. Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/wusbcore/devconnect.c')
-rw-r--r--drivers/usb/wusbcore/devconnect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 1d365316960c..33a12788f9ca 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -455,8 +455,8 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
dev_err(dev, "KEEPALIVE: device %u timed out\n",
wusb_dev->addr);
__wusbhc_dev_disconnect(wusbhc, wusb_port);
- } else if (time_after(jiffies, wusb_dev->entry_ts + tt/2)) {
- /* Approaching timeout cut out, need to refresh */
+ } else if (time_after(jiffies, wusb_dev->entry_ts + tt/3)) {
+ /* Approaching timeout cut off, need to refresh */
ie->bDeviceAddress[keep_alives++] = wusb_dev->addr;
}
}
@@ -1062,7 +1062,7 @@ int wusbhc_devconnect_start(struct wusbhc *wusbhc)
wusbhc->wuie_host_info = hi;
queue_delayed_work(wusbd, &wusbhc->keep_alive_timer,
- (wusbhc->trust_timeout*CONFIG_HZ)/1000/2);
+ msecs_to_jiffies(wusbhc->trust_timeout / 2));
return 0;