From b7dc805e0c1f3b810bf5cbc9db2dbfef908c8a6f Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 26 May 2006 21:36:28 +0100 Subject: [PATCH] --- yaml --- r: 28358 b: refs/heads/master c: 1fbe75e12f0dd567c86533e13ba2605f3ecad2e1 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/hub.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 831bf3331e89..4f007698d031 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 955a260829b5848fa90721678bab003234c93356 +refs/heads/master: 1fbe75e12f0dd567c86533e13ba2605f3ecad2e1 diff --git a/trunk/drivers/usb/core/hub.c b/trunk/drivers/usb/core/hub.c index 1b1846e6473b..89ebe6a23a90 100644 --- a/trunk/drivers/usb/core/hub.c +++ b/trunk/drivers/usb/core/hub.c @@ -1176,6 +1176,7 @@ static int choose_configuration(struct usb_device *udev) { int i; int num_configs; + int insufficient_power = 0; struct usb_host_config *c, *best; best = NULL; @@ -1228,8 +1229,10 @@ static int choose_configuration(struct usb_device *udev) */ /* Rule out configs that draw too much bus current */ - if (c->desc.bMaxPower * 2 > udev->bus_mA) + if (c->desc.bMaxPower * 2 > udev->bus_mA) { + insufficient_power++; continue; + } /* If the first config's first interface is COMM/2/0xff * (MSFT RNDIS), rule it out unless Linux has host-side @@ -1263,6 +1266,11 @@ static int choose_configuration(struct usb_device *udev) best = c; } + if (insufficient_power > 0) + dev_info(&udev->dev, "rejected %d configuration%s " + "due to insufficient available bus power\n", + insufficient_power, plural(insufficient_power)); + if (best) { i = best->desc.bConfigurationValue; dev_info(&udev->dev,