Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3671
b: refs/heads/master
c: 7d35b92
h: refs/heads/master
i:
  3669: e905dfd
  3667: e1001f0
  3663: 8080128
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jun 27, 2005
1 parent 6e2146f commit 16fb0f0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 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: f58f97fa9d258e4110ee1257a63cd1af51787f69
refs/heads/master: 7d35b9298539d2818c51fe9070b08cf9876016f4
1 change: 1 addition & 0 deletions trunk/drivers/usb/core/hcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
void __iomem *regs; /* device memory/io */
u64 rsrc_start; /* memory/io resource start */
u64 rsrc_len; /* memory/io resource length */
unsigned power_budget; /* in mA, 0 = no limit */

#define HCD_BUFFER_POOLS 4
struct dma_pool *pool [HCD_BUFFER_POOLS];
Expand Down
12 changes: 9 additions & 3 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 0 additions & 11 deletions trunk/drivers/usb/core/hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,4 @@ struct usb_hub {
struct work_struct leds;
};

/* use this for low-powered root hubs */
static inline void
hub_set_power_budget (struct usb_device *hubdev, unsigned mA)
{
struct usb_hub *hub;

hub = (struct usb_hub *)
usb_get_intfdata (hubdev->actconfig->interface[0]);
hub->power_budget = min(mA,(unsigned)500)/2;
}

#endif /* __LINUX_HUB_H */

0 comments on commit 16fb0f0

Please sign in to comment.