summaryrefslogtreecommitdiff
path: root/drivers/usb/core/hcd.h
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2005-07-29 12:18:28 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-29 13:12:54 -0700
commit498f78e6fcf558d0dec31f5648f43426ae16433f (patch)
tree8f07affd9ffd2324e5dcfa665aed8cb68e0ef88d /drivers/usb/core/hcd.h
parent6b216df87cb5f3bb7d47a33f1cd955ebc7b84dfd (diff)
[PATCH] USB: fix in usb_calc_bus_time
This patch does the same swap, i.e. use the ISO macro if (isoc). Additionally, it fixes the return value - the usb_calc_bus_time function returns the time in nanoseconds (I didn't notice that before) while the HS_USECS and HS_USECS_ISO are microseconds. This fixes the function to return nanoseconds always, and adjusts ehci-q.c (the only high-speed caller of the function) to wrap the call in NS_TO_US(). Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/usb/core/hcd.h')
-rw-r--r--drivers/usb/core/hcd.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 67db4a999b93..28055f95645b 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -334,17 +334,19 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb,
extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb);
/*
- * Ceiling microseconds (typical) for that many bytes at high speed
+ * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
* ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
* to preallocate bandwidth)
*/
#define USB2_HOST_DELAY 5 /* nsec, guess */
-#define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \
+#define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \
+ ((2083UL * (3167 + BitTime (bytes)))/1000) \
+ USB2_HOST_DELAY)
-#define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \
+#define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \
+ ((2083UL * (3167 + BitTime (bytes)))/1000) \
+ USB2_HOST_DELAY)
+#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes))
+#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes))
extern long usb_calc_bus_time (int speed, int is_input,
int isoc, int bytecount);