diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-11-14 11:45:38 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:48:31 -0500 |
commit | 1c50c317e2e7f15427149cbc216a63366468710e (patch) | |
tree | d48dc0b03090e89c644f73f9997b4f70b6ec9b41 /drivers/usb/core | |
parent | 8364d6b0be2dbbf162c6aea79615b5025a0d67c2 (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')
-rw-r--r-- | drivers/usb/core/hcd.h | 1 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index c8a1b350e2c..591b5aad1a1 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -380,6 +380,7 @@ extern int usb_find_interface_driver (struct usb_device *dev, | |||
380 | #ifdef CONFIG_PM | 380 | #ifdef CONFIG_PM |
381 | extern void usb_hcd_suspend_root_hub (struct usb_hcd *hcd); | 381 | extern void usb_hcd_suspend_root_hub (struct usb_hcd *hcd); |
382 | extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd); | 382 | extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd); |
383 | extern void usb_root_hub_lost_power (struct usb_device *rhdev); | ||
383 | extern int hcd_bus_suspend (struct usb_bus *bus); | 384 | extern int hcd_bus_suspend (struct usb_bus *bus); |
384 | extern int hcd_bus_resume (struct usb_bus *bus); | 385 | extern int hcd_bus_resume (struct usb_bus *bus); |
385 | #else | 386 | #else |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index f78bd124d29..5faf7edd73c 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, | |||
1039 | EXPORT_SYMBOL(usb_set_device_state); | 1039 | EXPORT_SYMBOL(usb_set_device_state); |
1040 | 1040 | ||
1041 | 1041 | ||
1042 | #ifdef CONFIG_PM | ||
1043 | |||
1044 | /** | ||
1045 | * usb_root_hub_lost_power - called by HCD if the root hub lost Vbus power | ||
1046 | * @rhdev: struct usb_device for the root hub | ||
1047 | * | ||
1048 | * The USB host controller driver calls this function when its root hub | ||
1049 | * is resumed and Vbus power has been interrupted or the controller | ||
1050 | * has been reset. The routine marks all the children of the root hub | ||
1051 | * as NOTATTACHED and marks logical connect-change events on their ports. | ||
1052 | */ | ||
1053 | void usb_root_hub_lost_power(struct usb_device *rhdev) | ||
1054 | { | ||
1055 | struct usb_hub *hub; | ||
1056 | int port1; | ||
1057 | unsigned long flags; | ||
1058 | |||
1059 | dev_warn(&rhdev->dev, "root hub lost power or was reset\n"); | ||
1060 | spin_lock_irqsave(&device_state_lock, flags); | ||
1061 | hub = hdev_to_hub(rhdev); | ||
1062 | for (port1 = 1; port1 <= rhdev->maxchild; ++port1) { | ||
1063 | if (rhdev->children[port1 - 1]) { | ||
1064 | recursively_mark_NOTATTACHED( | ||
1065 | rhdev->children[port1 - 1]); | ||
1066 | set_bit(port1, hub->change_bits); | ||
1067 | } | ||
1068 | } | ||
1069 | spin_unlock_irqrestore(&device_state_lock, flags); | ||
1070 | } | ||
1071 | EXPORT_SYMBOL_GPL(usb_root_hub_lost_power); | ||
1072 | |||
1073 | #endif | ||
1074 | |||
1042 | static void choose_address(struct usb_device *udev) | 1075 | static void choose_address(struct usb_device *udev) |
1043 | { | 1076 | { |
1044 | int devnum; | 1077 | int devnum; |