diff options
-rw-r--r-- | drivers/usb/core/hub.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0c87f73f2933..90b8d43c6b33 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1168,19 +1168,9 @@ static inline const char *plural(int n) | |||
1168 | static int choose_configuration(struct usb_device *udev) | 1168 | static int choose_configuration(struct usb_device *udev) |
1169 | { | 1169 | { |
1170 | int i; | 1170 | int i; |
1171 | u16 devstatus; | ||
1172 | int bus_powered; | ||
1173 | int num_configs; | 1171 | int num_configs; |
1174 | struct usb_host_config *c, *best; | 1172 | struct usb_host_config *c, *best; |
1175 | 1173 | ||
1176 | /* If this fails, assume the device is bus-powered */ | ||
1177 | devstatus = 0; | ||
1178 | usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); | ||
1179 | le16_to_cpus(&devstatus); | ||
1180 | bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0); | ||
1181 | dev_dbg(&udev->dev, "device is %s-powered\n", | ||
1182 | bus_powered ? "bus" : "self"); | ||
1183 | |||
1184 | best = NULL; | 1174 | best = NULL; |
1185 | c = udev->config; | 1175 | c = udev->config; |
1186 | num_configs = udev->descriptor.bNumConfigurations; | 1176 | num_configs = udev->descriptor.bNumConfigurations; |
@@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev) | |||
1197 | * similar errors in their descriptors. If the next test | 1187 | * similar errors in their descriptors. If the next test |
1198 | * were allowed to execute, such configurations would always | 1188 | * were allowed to execute, such configurations would always |
1199 | * be rejected and the devices would not work as expected. | 1189 | * be rejected and the devices would not work as expected. |
1190 | * In the meantime, we run the risk of selecting a config | ||
1191 | * that requires external power at a time when that power | ||
1192 | * isn't available. It seems to be the lesser of two evils. | ||
1193 | * | ||
1194 | * Bugzilla #6448 reports a device that appears to crash | ||
1195 | * when it receives a GET_DEVICE_STATUS request! We don't | ||
1196 | * have any other way to tell whether a device is self-powered, | ||
1197 | * but since we don't use that information anywhere but here, | ||
1198 | * the call has been removed. | ||
1199 | * | ||
1200 | * Maybe the GET_DEVICE_STATUS call and the test below can | ||
1201 | * be reinstated when device firmwares become more reliable. | ||
1202 | * Don't hold your breath. | ||
1200 | */ | 1203 | */ |
1201 | #if 0 | 1204 | #if 0 |
1202 | /* Rule out self-powered configs for a bus-powered device */ | 1205 | /* Rule out self-powered configs for a bus-powered device */ |