summaryrefslogtreecommitdiffstats
path: root/include/linux/usb/hcd.h
diff options
context:
space:
mode:
authorAlan Stern2013-10-11 17:28:02 +0200
committerGreg Kroah-Hartman2013-10-12 01:37:45 +0200
commit63fb3a280061c5a1d9190015e5a074213f9d23c0 (patch)
treed19fa5a572dfc898651194b3ab50848035cc423a /include/linux/usb/hcd.h
parentusb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done (diff)
downloadkernel-qcow2-linux-63fb3a280061c5a1d9190015e5a074213f9d23c0.tar.gz
kernel-qcow2-linux-63fb3a280061c5a1d9190015e5a074213f9d23c0.tar.xz
kernel-qcow2-linux-63fb3a280061c5a1d9190015e5a074213f9d23c0.zip
USB: NS_TO_US should round up
Host controller drivers use the NS_TO_US macro to convert transaction times, which are computed in nanoseconds, to microseconds for scheduling. Periodic scheduling requires worst-case estimates, but the macro does its conversion using round-to-nearest. This patch changes it to use round-up, giving a correct worst-case value. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb/hcd.h')
-rw-r--r--include/linux/usb/hcd.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index fc64b6825f5e..dbe3cd19ffd8 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -564,9 +564,8 @@ extern void usb_ep0_reinit(struct usb_device *);
* of (7/6 * 8 * bytecount) = 9.33 * bytecount */
/* bytecount = data payload byte count */
-#define NS_TO_US(ns) ((ns + 500L) / 1000L)
- /* convert & round nanoseconds to microseconds */
-
+#define NS_TO_US(ns) DIV_ROUND_UP(ns, 1000L)
+ /* convert nanoseconds to microseconds, rounding up */
/*
* Full/low speed bandwidth allocation constants/support.