diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-04-25 11:18:32 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-27 17:43:48 -0400 |
commit | 7d35b9298539d2818c51fe9070b08cf9876016f4 (patch) | |
tree | 32d539508821499c77b3c824232358ff4e8ecf25 /drivers/usb | |
parent | f58f97fa9d258e4110ee1257a63cd1af51787f69 (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')
-rw-r--r-- | drivers/usb/core/hcd.h | 1 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 12 | ||||
-rw-r--r-- | drivers/usb/core/hub.h | 11 |
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index ac5752778e39..3837f68bb7b3 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -87,6 +87,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ | |||
87 | void __iomem *regs; /* device memory/io */ | 87 | void __iomem *regs; /* device memory/io */ |
88 | u64 rsrc_start; /* memory/io resource start */ | 88 | u64 rsrc_start; /* memory/io resource start */ |
89 | u64 rsrc_len; /* memory/io resource length */ | 89 | u64 rsrc_len; /* memory/io resource length */ |
90 | unsigned power_budget; /* in mA, 0 = no limit */ | ||
90 | 91 | ||
91 | #define HCD_BUFFER_POOLS 4 | 92 | #define HCD_BUFFER_POOLS 4 |
92 | struct dma_pool *pool [HCD_BUFFER_POOLS]; | 93 | struct dma_pool *pool [HCD_BUFFER_POOLS]; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 6d1a330d577b..63ee3d97b6a9 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, | |||
643 | message = "can't get hub status"; | 643 | message = "can't get hub status"; |
644 | goto fail; | 644 | goto fail; |
645 | } | 645 | } |
646 | cpu_to_le16s(&hubstatus); | 646 | le16_to_cpus(&hubstatus); |
647 | if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) { | 647 | if (hdev == hdev->bus->root_hub) { |
648 | struct usb_hcd *hcd = | ||
649 | container_of(hdev->bus, struct usb_hcd, self); | ||
650 | |||
651 | hub->power_budget = min(500u, hcd->power_budget) / 2; | ||
652 | } else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) { | ||
648 | dev_dbg(hub_dev, "hub controller current requirement: %dmA\n", | 653 | dev_dbg(hub_dev, "hub controller current requirement: %dmA\n", |
649 | hub->descriptor->bHubContrCurrent); | 654 | hub->descriptor->bHubContrCurrent); |
650 | hub->power_budget = (501 - hub->descriptor->bHubContrCurrent) | 655 | hub->power_budget = (501 - hub->descriptor->bHubContrCurrent) |
651 | / 2; | 656 | / 2; |
657 | } | ||
658 | if (hub->power_budget) | ||
652 | dev_dbg(hub_dev, "%dmA bus power budget for children\n", | 659 | dev_dbg(hub_dev, "%dmA bus power budget for children\n", |
653 | hub->power_budget * 2); | 660 | hub->power_budget * 2); |
654 | } | ||
655 | 661 | ||
656 | 662 | ||
657 | ret = hub_hub_status(hub, &hubstatus, &hubchange); | 663 | ret = hub_hub_status(hub, &hubstatus, &hubchange); |
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index d114b847d56f..53bf5649621e 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h | |||
@@ -224,15 +224,4 @@ struct usb_hub { | |||
224 | struct work_struct leds; | 224 | struct work_struct leds; |
225 | }; | 225 | }; |
226 | 226 | ||
227 | /* use this for low-powered root hubs */ | ||
228 | static inline void | ||
229 | hub_set_power_budget (struct usb_device *hubdev, unsigned mA) | ||
230 | { | ||
231 | struct usb_hub *hub; | ||
232 | |||
233 | hub = (struct usb_hub *) | ||
234 | usb_get_intfdata (hubdev->actconfig->interface[0]); | ||
235 | hub->power_budget = min(mA,(unsigned)500)/2; | ||
236 | } | ||
237 | |||
238 | #endif /* __LINUX_HUB_H */ | 227 | #endif /* __LINUX_HUB_H */ |