All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Alan Stern <stern@rowland.harvard.edu>, Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to 3.12-stable] USB: change bInterval default to 10 ms
Date: Thu, 29 Sep 2016 11:06:22 +0200	[thread overview]
Message-ID: <20160929090654.27405-11-jslaby@suse.cz> (raw)
In-Reply-To: <20160929090654.27405-1-jslaby@suse.cz>

From: Alan Stern <stern@rowland.harvard.edu>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 08c5cd37480f59ea39682f4585d92269be6b1424 upstream.

Some full-speed mceusb infrared transceivers contain invalid endpoint
descriptors for their interrupt endpoints, with bInterval set to 0.
In the past they have worked out okay with the mceusb driver, because
the driver sets the bInterval field in the descriptor to 1,
overwriting whatever value may have been there before.  However, this
approach was never sanctioned by the USB core, and in fact it does not
work with xHCI controllers, because they use the bInterval value that
was present when the configuration was installed.

Currently usbcore uses 32 ms as the default interval if the value in
the endpoint descriptor is invalid.  It turns out that these IR
transceivers don't work properly unless the interval is set to 10 ms
or below.  To work around this mceusb problem, this patch changes the
endpoint-descriptor parsing routine, making the default interval value
be 10 ms rather than 32 ms.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Wade Berrier <wberrier@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/config.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 666cd3641d31..ce6225959f2c 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -213,8 +213,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
 	memcpy(&endpoint->desc, d, n);
 	INIT_LIST_HEAD(&endpoint->urb_list);
 
-	/* Fix up bInterval values outside the legal range. Use 32 ms if no
-	 * proper value can be guessed. */
+	/*
+	 * Fix up bInterval values outside the legal range.
+	 * Use 10 or 8 ms if no proper value can be guessed.
+	 */
 	i = 0;		/* i = min, j = max, n = default */
 	j = 255;
 	if (usb_endpoint_xfer_int(d)) {
@@ -223,13 +225,15 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
 		case USB_SPEED_SUPER_PLUS:
 		case USB_SPEED_SUPER:
 		case USB_SPEED_HIGH:
-			/* Many device manufacturers are using full-speed
+			/*
+			 * Many device manufacturers are using full-speed
 			 * bInterval values in high-speed interrupt endpoint
-			 * descriptors. Try to fix those and fall back to a
-			 * 32 ms default value otherwise. */
+			 * descriptors. Try to fix those and fall back to an
+			 * 8-ms default value otherwise.
+			 */
 			n = fls(d->bInterval*8);
 			if (n == 0)
-				n = 9;	/* 32 ms = 2^(9-1) uframes */
+				n = 7;	/* 8 ms = 2^(7-1) uframes */
 			j = 16;
 
 			/*
@@ -244,10 +248,12 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
 			}
 			break;
 		default:		/* USB_SPEED_FULL or _LOW */
-			/* For low-speed, 10 ms is the official minimum.
+			/*
+			 * For low-speed, 10 ms is the official minimum.
 			 * But some "overclocked" devices might want faster
-			 * polling so we'll allow it. */
-			n = 32;
+			 * polling so we'll allow it.
+			 */
+			n = 10;
 			break;
 		}
 	} else if (usb_endpoint_xfer_isoc(d)) {
@@ -255,10 +261,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
 		j = 16;
 		switch (to_usb_device(ddev)->speed) {
 		case USB_SPEED_HIGH:
-			n = 9;		/* 32 ms = 2^(9-1) uframes */
+			n = 7;		/* 8 ms = 2^(7-1) uframes */
 			break;
 		default:		/* USB_SPEED_FULL */
-			n = 6;		/* 32 ms = 2^(6-1) frames */
+			n = 4;		/* 8 ms = 2^(4-1) frames */
 			break;
 		}
 	}
-- 
2.10.0


  parent reply	other threads:[~2016-09-29  9:07 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29  9:06 [patch added to 3.12-stable] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] powerpc/mm: Don't alias user region to other regions below PAGE_OFFSET Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] NFSv4.x: Fix a refcount leak in nfs_callback_up_net Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] dm flakey: fix reads to be issued if drop_writes configured Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] x86/paravirt: Do not trace _paravirt_ident_*() functions Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] kvm-arm: Unmap shadow pagetables properly Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] iio: accel: kxsd9: Fix raw read return Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] iio: accel: kxsd9: Fix scaling bug Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] USB: serial: simple: add support for another Infineon flashloader Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition Jiri Slaby
2016-09-29  9:06 ` Jiri Slaby [this message]
2016-09-29  9:06 ` [patch added to 3.12-stable] ARM: OMAP3: hwmod data: Add sysc information for DSI Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] arm64: spinlocks: implement smp_mb__before_spinlock() as smp_mb() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] crypto: cryptd - initialize child shash_desc on import Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] microblaze: fix __get_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] avr32: fix copy_from_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] microblaze: " Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] fix minor infoleak in get_user_ex() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] mn10300: failing __get_user() and get_user() should zero Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] m32r: fix __get_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] sh64: failing __get_user() should zero Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] score: fix __get_user/get_user Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] s390: get_user() should zero on failure Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] ARC: uaccess: get_user to zero out dest in cause of fault Jiri Slaby
2016-09-29  9:06   ` Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] asm-generic: make get_user() clear the destination on errors Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] frv: fix clear_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] cris: buggered copy_from_user/copy_to_user/clear_user Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] blackfin: fix copy_from_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] score: fix copy_from_user() and friends Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] sh: fix copy_from_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] hexagon: fix strncpy_from_user() error return Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] mips: copy_from_user() must zero the destination on access_ok() failure Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] asm-generic: make copy_from_user() zero the destination properly Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] alpha: fix copy_from_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] metag: copy_from_user() should zero the destination on access_ok() failure Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] parisc: fix copy_from_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] openrisc: " Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] mn10300: copy_from_user() should zero on access_ok() failure Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] sparc32: fix copy_from_user() Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] ppc32: " Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] ia64: copy_from_user() should zero the destination on access_ok() failure Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] avr32: fix 'undefined reference to `___copy_from_user' Jiri Slaby
2016-09-29  9:06 ` [patch added to 3.12-stable] openrisc: fix the fix of copy_from_user() Jiri Slaby

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=20160929090654.27405-11-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.