]> git.baikalelectronics.ru Git - kernel.git/commit
USB: xHCI: override bogus bulk wMaxPacketSize values
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 8 May 2013 15:18:05 +0000 (11:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 May 2013 17:41:39 +0000 (13:41 -0400)
commit5d7d58f5dc55152bad73afde202312db371a00bd
treeab22d874a67160c6bcab91dc5c8c312cd54da902
parentc94c84dadb10ba9c6ec30cc35d3b10ca10c803b4
USB: xHCI: override bogus bulk wMaxPacketSize values

This patch shortens the logic in xhci_endpoint_init() by moving common
calculations involving max_packet and max_burst outside the switch
statement, rather than repeating the same code in multiple
case-specific statements.  It also replaces two usages of max_packet
which were clearly intended to be max_burst all along.

More importantly, it compensates for a common bug in high-speed bulk
endpoint descriptors.  In many devices there is a bulk endpoint having
a wMaxPacketSize value smaller than 512, which is forbidden by the USB
spec.  Some xHCI controllers can't handle this and refuse to accept
the endpoint.  This patch changes the max_packet value to 512, which
allows the controller to use the endpoint properly.

In practice the bogus maxpacket size doesn't matter, because none of
the transfers sent via these endpoints are longer than the maxpacket
value anyway.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: "Aurélien Leblond" <blablack@gmail.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mem.c