From: Greg KH <gregkh@suse.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, ddstreet@ieee.org
Subject: [patch 28/29] USB: fix in usb_calc_bus_time
Date: Fri, 29 Jul 2005 12:18:28 -0700 [thread overview]
Message-ID: <20050729191828.GD5095@kroah.com> (raw)
In-Reply-To: <20050729191255.GA5095@kroah.com>
[-- Attachment #1: usb-fix-usb_calc_bus_time.patch --]
[-- Type: text/plain, Size: 2928 bytes --]
From: Dan Streetman <ddstreet@ieee.org>
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>
---
drivers/usb/core/hcd.c | 4 ++--
drivers/usb/core/hcd.h | 8 +++++---
drivers/usb/host/ehci-q.c | 4 ++--
3 files changed, 9 insertions(+), 7 deletions(-)
--- gregkh-2.6.orig/drivers/usb/core/hcd.c 2005-07-29 11:30:03.000000000 -0700
+++ gregkh-2.6/drivers/usb/core/hcd.c 2005-07-29 11:36:34.000000000 -0700
@@ -939,9 +939,9 @@
case USB_SPEED_HIGH: /* ISOC or INTR */
// FIXME adjust for input vs output
if (isoc)
- tmp = HS_USECS (bytecount);
+ tmp = HS_NSECS_ISO (bytecount);
else
- tmp = HS_USECS_ISO (bytecount);
+ tmp = HS_NSECS (bytecount);
return tmp;
default:
pr_debug ("%s: bogus device speed!\n", usbcore_name);
--- gregkh-2.6.orig/drivers/usb/core/hcd.h 2005-07-29 11:29:47.000000000 -0700
+++ gregkh-2.6/drivers/usb/core/hcd.h 2005-07-29 11:36:34.000000000 -0700
@@ -334,17 +334,19 @@
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);
--- gregkh-2.6.orig/drivers/usb/host/ehci-q.c 2005-07-29 11:29:47.000000000 -0700
+++ gregkh-2.6/drivers/usb/host/ehci-q.c 2005-07-29 11:36:34.000000000 -0700
@@ -657,8 +657,8 @@
* For control/bulk requests, the HC or TT handles these.
*/
if (type == PIPE_INTERRUPT) {
- qh->usecs = usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0,
- hb_mult (maxp) * max_packet (maxp));
+ qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0,
+ hb_mult (maxp) * max_packet (maxp)));
qh->start = NO_FRAME;
if (urb->dev->speed == USB_SPEED_HIGH) {
--
next prev parent reply other threads:[~2005-07-30 0:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050729184950.014589000@press.kroah.org>
2005-07-29 19:12 ` [patch 00/29] fixes for 2.6.13-rc4 Greg KH
2005-07-29 19:13 ` [patch 02/29] sysfs: fix sysfs_chmod_file Greg KH
2005-07-29 19:14 ` [patch 01/29] stable_api_nonsense.txt fixes Greg KH
2005-07-29 19:14 ` [patch 03/29] sysfs: fix sysfs_setattr Greg KH
2005-07-29 19:14 ` [patch 04/29] DEBUG_FS must depend on SYSFS Greg KH
2005-07-29 19:14 ` [patch 05/29] Add the rules about the -stable kernel releases to the Documentation directory Greg KH
2005-07-29 19:14 ` [patch 06/29] I2C-MPC: Restore code removed Greg KH
2005-07-29 19:15 ` [patch 07/29] I2C: ds1337 - fix 12/24 hour mode bug Greg KH
2005-07-29 19:15 ` [patch 08/29] I2C: Missing space in split strings Greg KH
2005-07-29 19:15 ` [patch 09/29] I2C: use time_after in 3 chip drivers Greg KH
2005-07-29 19:15 ` [patch 10/29] I2C: missing new lines in i2c-core messages Greg KH
2005-07-29 19:15 ` [patch 11/29] I2C: 24RF08 corruption prevention (again) Greg KH
2005-07-29 19:15 ` [patch 12/29] w1: kconfig/Makefile fix Greg KH
2005-07-29 19:15 ` [patch 13/29] PCI: Hidden SMBus bridge on Toshiba Tecra M2 Greg KH
2005-07-29 19:16 ` [patch 14/29] PCI: Adjust PCI rom code to handle more broken ROMs Greg KH
2005-07-29 19:16 ` [patch 15/29] PCI: remove PCI_BRIDGE_CTL_VGA handling from setup-bus.c Greg KH
2005-07-29 19:16 ` [patch 16/29] PCI: fix up errors after dma bursting patch and CONFIG_PCI=n -- bug? Greg KH
2005-07-29 19:16 ` [patch 17/29] USB: ftdi_sio: new microHAM and Evolution Robotics devices Greg KH
2005-07-29 19:16 ` [patch 18/29] USB: ftdi_sio: Update RTS and DTR simultaneously Greg KH
2005-07-29 19:16 ` [patch 19/29] USB: ftdi_sio: fix a couple of timeouts Greg KH
2005-07-29 19:16 ` [patch 20/29] USB: usbfs: Don't leak uninitialized data Greg KH
2005-07-29 19:17 ` [patch 21/29] USB: drivers/usb/net/: remove two unused multicast_filter_limit variables Greg KH
2005-07-29 19:17 ` [patch 22/29] USB: Usbcore: Don't try to delete unregistered interfaces Greg KH
2005-07-29 19:17 ` [patch 23/29] USB: ldusb fixes Greg KH
2005-07-29 19:17 ` [patch 24/29] USB: Patch for KYOCERA AH-K3001V support Greg KH
2005-07-29 19:17 ` [patch 25/29] USB: drivers/net/usb/zd1201.c: Gigabyte GN-WLBZ201 dongle usbid Greg KH
2005-07-29 19:18 ` [patch 26/29] USB: add S3C24XX USB Host driver support Greg KH
2005-07-29 19:18 ` [patch 27/29] USB: fix Bug in usb-skeleton.c Greg KH
2005-07-29 19:18 ` Greg KH [this message]
2005-07-29 19:18 ` [patch 29/29] USB: hidinput_hid_event() oops fix Greg KH
2005-07-29 19:13 ` [patch 01/29] stable_api_nonsense.txt fixes Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050729191828.GD5095@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@osdl.org \
--cc=ddstreet@ieee.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox