summaryrefslogtreecommitdiff
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-11-14 11:45:38 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 13:48:31 -0800
commit1c50c317e2e7f15427149cbc216a63366468710e (patch)
treed48dc0b03090e89c644f73f9997b4f70b6ec9b41 /drivers/usb/core/hub.c
parent8364d6b0be2dbbf162c6aea79615b5025a0d67c2 (diff)
[PATCH] USB: central handling for host controllers that were reset during suspend/resume
This patch (as515b) adds a routine to usbcore to simplify handling of host controllers that lost power or were reset during suspend/resume. The new core routine marks all the child devices of the root hub as NOTATTACHED and tells khubd to disconnect the device structures as soon as possible. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f78bd124d290..5faf7edd73cb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1039,6 +1039,39 @@ void usb_set_device_state(struct usb_device *udev,
EXPORT_SYMBOL(usb_set_device_state);
+#ifdef CONFIG_PM
+
+/**
+ * usb_root_hub_lost_power - called by HCD if the root hub lost Vbus power
+ * @rhdev: struct usb_device for the root hub
+ *
+ * The USB host controller driver calls this function when its root hub
+ * is resumed and Vbus power has been interrupted or the controller
+ * has been reset. The routine marks all the children of the root hub
+ * as NOTATTACHED and marks logical connect-change events on their ports.
+ */
+void usb_root_hub_lost_power(struct usb_device *rhdev)
+{
+ struct usb_hub *hub;
+ int port1;
+ unsigned long flags;
+
+ dev_warn(&rhdev->dev, "root hub lost power or was reset\n");
+ spin_lock_irqsave(&device_state_lock, flags);
+ hub = hdev_to_hub(rhdev);
+ for (port1 = 1; port1 <= rhdev->maxchild; ++port1) {
+ if (rhdev->children[port1 - 1]) {
+ recursively_mark_NOTATTACHED(
+ rhdev->children[port1 - 1]);
+ set_bit(port1, hub->change_bits);
+ }
+ }
+ spin_unlock_irqrestore(&device_state_lock, flags);
+}
+EXPORT_SYMBOL_GPL(usb_root_hub_lost_power);
+
+#endif
+
static void choose_address(struct usb_device *udev)
{
int devnum;