aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2010-01-05 17:33:29 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:54:04 -0500
commitd837e219daf3bf0cc84fcfb9781807d9fe8d03b5 (patch)
tree7b28362df13ca2807e66f31aefeb59599d3b648f /drivers/usb/core
parent46216e4fbe8c62059b5440dec0b236f386248a41 (diff)
USB: Use bInterfaceNumber in bandwidth allocations.
USB devices do not have to sort interfaces in their descriptors based on the interface number, and they may choose to skip interface numbers. The USB bandwidth allocation code for installing a new configuration assumes the for loop variable will match the interface number. Make it use the interface number (bInterfaceNumber) in the descriptor instead. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/hcd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 80995ef0868c..cf0a098a5432 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1670,11 +1670,16 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev,
1670 } 1670 }
1671 } 1671 }
1672 for (i = 0; i < num_intfs; ++i) { 1672 for (i = 0; i < num_intfs; ++i) {
1673 struct usb_host_interface *first_alt;
1674 int iface_num;
1675
1676 first_alt = &new_config->intf_cache[i]->altsetting[0];
1677 iface_num = first_alt->desc.bInterfaceNumber;
1673 /* Set up endpoints for alternate interface setting 0 */ 1678 /* Set up endpoints for alternate interface setting 0 */
1674 alt = usb_find_alt_setting(new_config, i, 0); 1679 alt = usb_find_alt_setting(new_config, iface_num, 0);
1675 if (!alt) 1680 if (!alt)
1676 /* No alt setting 0? Pick the first setting. */ 1681 /* No alt setting 0? Pick the first setting. */
1677 alt = &new_config->intf_cache[i]->altsetting[0]; 1682 alt = first_alt;
1678 1683
1679 for (j = 0; j < alt->desc.bNumEndpoints; j++) { 1684 for (j = 0; j < alt->desc.bNumEndpoints; j++) {
1680 ret = hcd->driver->add_endpoint(hcd, udev, &alt->endpoint[j]); 1685 ret = hcd->driver->add_endpoint(hcd, udev, &alt->endpoint[j]);