]> git.karo-electronics.de Git - karo-tx-linux.git/commit
usb: xhci: Correct last context entry calculation for Configure Endpoint
authorJulius Werner <jwerner@chromium.org>
Tue, 24 Jun 2014 14:14:42 +0000 (17:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jun 2014 16:31:11 +0000 (12:31 -0400)
commitd6759133e9815ef807b17dc752aff8c3771b7444
treedd9c703b6f9ee3c0c001d4d86c4a1f02e10b853f
parenta497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee
usb: xhci: Correct last context entry calculation for Configure Endpoint

The current XHCI driver recalculates the Context Entries field in the
Slot Context on every add_endpoint() and drop_endpoint() call. In the
case of drop_endpoint(), it seems to assume that the add_flags will
always contain every endpoint for the new configuration, which is not
necessarily correct if you don't make assumptions about how the USB core
uses the add_endpoint/drop_endpoint interface (add_flags only contains
endpoints that are new additions in the new configuration).

Furthermore, EP0_FLAG is not consistently set in add_flags throughout
the lifetime of a device. This means that when all endpoints are
dropped, the Context Entries field can be set to 0 (which is invalid and
may cause a Parameter Error) or -1 (which is interpreted as 31 and
causes the driver to keep using the old, incorrect value).

The only surefire way to set this field right is to also take all
existing endpoints into account, and to force the value to 1 (meaning
only EP0 is active) if no other endpoint is found. This patch implements
that as a single step in the final check_bandwidth() call and removes
the intermediary calculations from add_endpoint() and drop_endpoint().

Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c