USB: Don't resume root hub if the controller is suspended
Root hubs can't be resumed if their parent controller device is still
suspended. This patch (as925) adds a check for that condition in
hcd_bus_resume() and prevents it from being treated as a fatal
controller failure.
ehci-hcd is updated to add the corresponding test. Unnecessary
debugging messages are removed from uhci-hcd and dummy-hcd. The
error return code from dummy-hcd is changed to -ESHUTDOWN, the same as
the others. ohci-hcd doesn't need any changes.
Suspend handling in the non-PCI host drivers is somewhat hit-and-miss.
This patch shouldn't have any effect on them.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5254c50..963520f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1291,6 +1291,7 @@
{
struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self);
int status;
+ int old_state = hcd->state;
dev_dbg(&rhdev->dev, "usb %s%s\n",
rhdev->auto_pm ? "auto-" : "", "resume");
@@ -1309,9 +1310,11 @@
: USB_STATE_ADDRESS);
hcd->state = HC_STATE_RUNNING;
} else {
+ hcd->state = old_state;
dev_dbg(&rhdev->dev, "bus %s fail, err %d\n",
"resume", status);
- usb_hc_died(hcd);
+ if (status != -ESHUTDOWN)
+ usb_hc_died(hcd);
}
return status;
}