Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26664
b: refs/heads/master
c: 436f576
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed May 9, 2006
1 parent 8801063 commit 95f6112
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db4cefaaea4c6d67cdaebfd315abc791c5c9d22f
refs/heads/master: 436f5762bcd4929825a0725d4bc78337e6fc0d8f
23 changes: 13 additions & 10 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1168,19 +1168,9 @@ static inline const char *plural(int n)
static int choose_configuration(struct usb_device *udev)
{
int i;
u16 devstatus;
int bus_powered;
int num_configs;
struct usb_host_config *c, *best;

/* If this fails, assume the device is bus-powered */
devstatus = 0;
usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
le16_to_cpus(&devstatus);
bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);
dev_dbg(&udev->dev, "device is %s-powered\n",
bus_powered ? "bus" : "self");

best = NULL;
c = udev->config;
num_configs = udev->descriptor.bNumConfigurations;
Expand All @@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev)
* similar errors in their descriptors. If the next test
* were allowed to execute, such configurations would always
* be rejected and the devices would not work as expected.
* In the meantime, we run the risk of selecting a config
* that requires external power at a time when that power
* isn't available. It seems to be the lesser of two evils.
*
* Bugzilla #6448 reports a device that appears to crash
* when it receives a GET_DEVICE_STATUS request! We don't
* have any other way to tell whether a device is self-powered,
* but since we don't use that information anywhere but here,
* the call has been removed.
*
* Maybe the GET_DEVICE_STATUS call and the test below can
* be reinstated when device firmwares become more reliable.
* Don't hold your breath.
*/
#if 0
/* Rule out self-powered configs for a bus-powered device */
Expand Down

0 comments on commit 95f6112

Please sign in to comment.