diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2010-12-09 14:52:41 -0800 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-03-13 18:07:08 -0700 |
commit | 1d5810b6923c76fc95e52d9d3491c91824c2f075 (patch) | |
tree | 714c95e2f75cf703442abb4dd8f2cb522200616d /drivers/usb/host/xhci-mem.c | |
parent | abc4f9b099e9e7db3f6f945210aee125571c236d (diff) | |
download | op-kernel-dev-1d5810b6923c76fc95e52d9d3491c91824c2f075.zip op-kernel-dev-1d5810b6923c76fc95e52d9d3491c91824c2f075.tar.gz |
xhci: Rework port suspend structures for limited ports.
The USB core only allows up to 31 (USB_MAXCHILDREN) ports under a roothub.
The xHCI driver keeps track of which ports are suspended, which ports have
a suspend change bit set, and what time the port will be done resuming.
It keeps track of the first two by setting a bit in a u32 variable,
suspended_ports or port_c_suspend. The xHCI driver currently assumes we
can have up to 256 ports under a roothub, so it allocates an array of 8
u32 variables for both suspended_ports and port_c_suspend. It also
allocates a 256-element array to keep track of when the ports will be done
resuming.
Since we can only have 31 roothub ports, we only need to use one u32 for
each of the suspend state and change variables. We simplify the bit math
that's trying to index into those arrays and set the correct bit, if we
assume wIndex never exceeds 30. (wIndex is zero-based after it's
decremented from the value passed in from the USB core.) Finally, we
change the resume_done array to only hold 31 elements.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Andiry Xu <andiry.xu@amd.com>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r-- | drivers/usb/host/xhci-mem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1d0f45f..e3e6410 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1971,7 +1971,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) init_completion(&xhci->addr_dev); for (i = 0; i < MAX_HC_SLOTS; ++i) xhci->devs[i] = NULL; - for (i = 0; i < MAX_HC_PORTS; ++i) + for (i = 0; i < USB_MAXCHILDREN; ++i) xhci->resume_done[i] = 0; if (scratchpad_alloc(xhci, flags)) |