USB: xhci: Make reverting an alt setting "unfailable".
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Thu, 3 Dec 2009 17:44:29 +0000 (09:44 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Dec 2009 19:55:27 +0000 (11:55 -0800)
commit74f9fe21e0440066eb337b9f644238cb3050b91c
treeb4ab839ba1a02cf2e6834ae3013b24e59e1e76c4
parent3342ecda3ffb059f2ffd765a71d9579f0aa036eb
USB: xhci: Make reverting an alt setting "unfailable".

When a driver wants to switch to a different alternate setting for an
interface, the USB core will (soon) check whether there is enough
bandwidth.  Once the new alternate setting is installed in the xHCI
hardware, the USB core will send a USB_REQ_SET_INTERFACE control
message.  That can fail in various ways, and the USB core needs to be
able to reinstate the old alternate setting.

With the old code, reinstating the old alt setting could fail if the
there's not enough memory to allocate new endpoint rings.  Keep
around a cache of (at most 31) endpoint rings for this case.  When we
successfully switch the xHCI hardware to the new alt setting, the old
alt setting's rings will be stored in the cache.  Therefore we'll
always have enough rings to satisfy a conversion back to a previous
device setting.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/xhci-hcd.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci.h