@@ -4263,10 +4263,13 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
{
int reserved_trbs = xhci->cmd_ring_reserved_trbs;
int ret;
+ struct usb_hcd *hcd = xhci_to_hcd(xhci);
if ((xhci->xhc_state & XHCI_STATE_DYING) ||
- (xhci->xhc_state & XHCI_STATE_HALTED)) {
- xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n");
+ (xhci->xhc_state & XHCI_STATE_HALTED) ||
+ !HCD_HW_ACCESSIBLE(hcd)) {
+ xhci_dbg(xhci,
+ "xHCI dying or halted,or hcd hw can't accessible,can't queue_command\n");
return -ESHUTDOWN;
}
@@ -1006,10 +1006,6 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
time_before(jiffies, xhci->usb3_rhub.bus_state.next_statechange))
msleep(100);
- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
- if (xhci->shared_hcd)
- set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
-
spin_lock_irq(&xhci->lock);
if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend)
@@ -1133,9 +1129,13 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
spin_unlock_irq(&xhci->lock);
+ done:
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+ if (xhci->shared_hcd)
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
+
xhci_dbc_resume(xhci);
- done:
if (retval == 0) {
/*
* Resume roothubs only if there are pending events.