aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2005-07-29 15:18:28 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-29 16:12:54 -0400
commit498f78e6fcf558d0dec31f5648f43426ae16433f (patch)
tree8f07affd9ffd2324e5dcfa665aed8cb68e0ef88d /drivers
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')
-rw-r--r--drivers/usb/core/hcd.c4
-rw-r--r--drivers/usb/core/hcd.h8
-rw-r--r--drivers/usb/host/ehci-q.c4
3 files changed, 9 insertions, 7 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8616356f55e8..79422a3b07bc 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -939,9 +939,9 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount)
939 case USB_SPEED_HIGH: /* ISOC or INTR */ 939 case USB_SPEED_HIGH: /* ISOC or INTR */
940 // FIXME adjust for input vs output 940 // FIXME adjust for input vs output
941 if (isoc) 941 if (isoc)
942 tmp = HS_USECS (bytecount); 942 tmp = HS_NSECS_ISO (bytecount);
943 else 943 else
944 tmp = HS_USECS_ISO (bytecount); 944 tmp = HS_NSECS (bytecount);
945 return tmp; 945 return tmp;
946 default: 946 default:
947 pr_debug ("%s: bogus device speed!\n", usbcore_name); 947 pr_debug ("%s: bogus device speed!\n", usbcore_name);
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,
334extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); 334extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb);
335 335
336/* 336/*
337 * Ceiling microseconds (typical) for that many bytes at high speed 337 * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
338 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed 338 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
339 * to preallocate bandwidth) 339 * to preallocate bandwidth)
340 */ 340 */
341#define USB2_HOST_DELAY 5 /* nsec, guess */ 341#define USB2_HOST_DELAY 5 /* nsec, guess */
342#define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \ 342#define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \
343 + ((2083UL * (3167 + BitTime (bytes)))/1000) \ 343 + ((2083UL * (3167 + BitTime (bytes)))/1000) \
344 + USB2_HOST_DELAY) 344 + USB2_HOST_DELAY)
345#define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \ 345#define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \
346 + ((2083UL * (3167 + BitTime (bytes)))/1000) \ 346 + ((2083UL * (3167 + BitTime (bytes)))/1000) \
347 + USB2_HOST_DELAY) 347 + USB2_HOST_DELAY)
348#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes))
349#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes))
348 350
349extern long usb_calc_bus_time (int speed, int is_input, 351extern long usb_calc_bus_time (int speed, int is_input,
350 int isoc, int bytecount); 352 int isoc, int bytecount);
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index d74b2d68a50e..4f97a4ad1ed3 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -657,8 +657,8 @@ qh_make (
657 * For control/bulk requests, the HC or TT handles these. 657 * For control/bulk requests, the HC or TT handles these.
658 */ 658 */
659 if (type == PIPE_INTERRUPT) { 659 if (type == PIPE_INTERRUPT) {
660 qh->usecs = usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, 660 qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0,
661 hb_mult (maxp) * max_packet (maxp)); 661 hb_mult (maxp) * max_packet (maxp)));
662 qh->start = NO_FRAME; 662 qh->start = NO_FRAME;
663 663
664 if (urb->dev->speed == USB_SPEED_HIGH) { 664 if (urb->dev->speed == USB_SPEED_HIGH) {