diff options
| -rw-r--r-- | drivers/usb/core/hub.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1b1846e6473b..89ebe6a23a90 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -1176,6 +1176,7 @@ static int choose_configuration(struct usb_device *udev) | |||
| 1176 | { | 1176 | { |
| 1177 | int i; | 1177 | int i; |
| 1178 | int num_configs; | 1178 | int num_configs; |
| 1179 | int insufficient_power = 0; | ||
| 1179 | struct usb_host_config *c, *best; | 1180 | struct usb_host_config *c, *best; |
| 1180 | 1181 | ||
| 1181 | best = NULL; | 1182 | best = NULL; |
| @@ -1228,8 +1229,10 @@ static int choose_configuration(struct usb_device *udev) | |||
| 1228 | */ | 1229 | */ |
| 1229 | 1230 | ||
| 1230 | /* Rule out configs that draw too much bus current */ | 1231 | /* Rule out configs that draw too much bus current */ |
| 1231 | if (c->desc.bMaxPower * 2 > udev->bus_mA) | 1232 | if (c->desc.bMaxPower * 2 > udev->bus_mA) { |
| 1233 | insufficient_power++; | ||
| 1232 | continue; | 1234 | continue; |
| 1235 | } | ||
| 1233 | 1236 | ||
| 1234 | /* If the first config's first interface is COMM/2/0xff | 1237 | /* If the first config's first interface is COMM/2/0xff |
| 1235 | * (MSFT RNDIS), rule it out unless Linux has host-side | 1238 | * (MSFT RNDIS), rule it out unless Linux has host-side |
| @@ -1263,6 +1266,11 @@ static int choose_configuration(struct usb_device *udev) | |||
| 1263 | best = c; | 1266 | best = c; |
| 1264 | } | 1267 | } |
| 1265 | 1268 | ||
| 1269 | if (insufficient_power > 0) | ||
| 1270 | dev_info(&udev->dev, "rejected %d configuration%s " | ||
| 1271 | "due to insufficient available bus power\n", | ||
| 1272 | insufficient_power, plural(insufficient_power)); | ||
| 1273 | |||
| 1266 | if (best) { | 1274 | if (best) { |
| 1267 | i = best->desc.bConfigurationValue; | 1275 | i = best->desc.bConfigurationValue; |
| 1268 | dev_info(&udev->dev, | 1276 | dev_info(&udev->dev, |
