Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] USB: usbcore: don't check the device's power source

The choose_configuration() routine contains code the determine the
device's power source, so that configurations requiring external power
can be ruled out if the device is running on bus power. Unfortunately
it turns out that some devices have errors in their config descriptors
and other devices don't like the GET_DEVICE_STATUS request.

Since that information wasn't used for anything else, this patch (as673)
removes the code, leaving only a comment. It fixes bugzilla entry
#6448.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
436f5762 db4cefaa

+13 -10
+13 -10
drivers/usb/core/hub.c
··· 1168 1168 static int choose_configuration(struct usb_device *udev) 1169 1169 { 1170 1170 int i; 1171 - u16 devstatus; 1172 - int bus_powered; 1173 1171 int num_configs; 1174 1172 struct usb_host_config *c, *best; 1175 - 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 1173 1184 1174 best = NULL; 1185 1175 c = udev->config; ··· 1187 1197 * similar errors in their descriptors. If the next test 1188 1198 * were allowed to execute, such configurations would always 1189 1199 * be rejected and the devices would not work as expected. 1200 + * In the meantime, we run the risk of selecting a config 1201 + * that requires external power at a time when that power 1202 + * isn't available. It seems to be the lesser of two evils. 1203 + * 1204 + * Bugzilla #6448 reports a device that appears to crash 1205 + * when it receives a GET_DEVICE_STATUS request! We don't 1206 + * have any other way to tell whether a device is self-powered, 1207 + * but since we don't use that information anywhere but here, 1208 + * the call has been removed. 1209 + * 1210 + * Maybe the GET_DEVICE_STATUS call and the test below can 1211 + * be reinstated when device firmwares become more reliable. 1212 + * Don't hold your breath. 1190 1213 */ 1191 1214 #if 0 1192 1215 /* Rule out self-powered configs for a bus-powered device */