aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-04-25 11:18:32 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 14:43:48 -0700
commit7d35b9298539d2818c51fe9070b08cf9876016f4 (patch)
tree32d539508821499c77b3c824232358ff4e8ecf25 /drivers/usb/core/hub.c
parentf58f97fa9d258e4110ee1257a63cd1af51787f69 (diff)
[PATCH] usbcore: Remove hub_set_power_budget
This patch removes the hub_set_power_budget routine, which was used by a couple of HCDs to indicate that the root hub was running on battery power. In its place is a new field added to struct usb_hcd, which HCDs can set before the root hub is registered. Special-case code in the hub driver knows to look at this field when configuring a root hub. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 6d1a330d577..63ee3d97b6a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -643,15 +643,21 @@ static int hub_configure(struct usb_hub *hub,
message = "can't get hub status";
goto fail;
}
- cpu_to_le16s(&hubstatus);
- if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
+ le16_to_cpus(&hubstatus);
+ if (hdev == hdev->bus->root_hub) {
+ struct usb_hcd *hcd =
+ container_of(hdev->bus, struct usb_hcd, self);
+
+ hub->power_budget = min(500u, hcd->power_budget) / 2;
+ } else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
hub->descriptor->bHubContrCurrent);
hub->power_budget = (501 - hub->descriptor->bHubContrCurrent)
/ 2;
+ }
+ if (hub->power_budget)
dev_dbg(hub_dev, "%dmA bus power budget for children\n",
hub->power_budget * 2);
- }
ret = hub_hub_status(hub, &hubstatus, &hubchange);