diff options
-rw-r--r-- | drivers/usb/host/xhci-pci.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/xhci.h | 1 |
4 files changed, 9 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 071b34ae9c4e..48672fac7ff3 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -304,6 +304,7 @@ static void xhci_pci_remove(struct pci_dev *dev) | |||
304 | struct xhci_hcd *xhci; | 304 | struct xhci_hcd *xhci; |
305 | 305 | ||
306 | xhci = hcd_to_xhci(pci_get_drvdata(dev)); | 306 | xhci = hcd_to_xhci(pci_get_drvdata(dev)); |
307 | xhci->xhc_state |= XHCI_STATE_REMOVING; | ||
307 | if (xhci->shared_hcd) { | 308 | if (xhci->shared_hcd) { |
308 | usb_remove_hcd(xhci->shared_hcd); | 309 | usb_remove_hcd(xhci->shared_hcd); |
309 | usb_put_hcd(xhci->shared_hcd); | 310 | usb_put_hcd(xhci->shared_hcd); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 7cf66212ceae..99b4ff42f7a0 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -4004,7 +4004,8 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, | |||
4004 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; | 4004 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; |
4005 | int ret; | 4005 | int ret; |
4006 | 4006 | ||
4007 | if (xhci->xhc_state) { | 4007 | if ((xhci->xhc_state & XHCI_STATE_DYING) || |
4008 | (xhci->xhc_state & XHCI_STATE_HALTED)) { | ||
4008 | xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); | 4009 | xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); |
4009 | return -ESHUTDOWN; | 4010 | return -ESHUTDOWN; |
4010 | } | 4011 | } |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 9283d3331b59..9e71c96ad74a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -147,7 +147,8 @@ static int xhci_start(struct xhci_hcd *xhci) | |||
147 | "waited %u microseconds.\n", | 147 | "waited %u microseconds.\n", |
148 | XHCI_MAX_HALT_USEC); | 148 | XHCI_MAX_HALT_USEC); |
149 | if (!ret) | 149 | if (!ret) |
150 | xhci->xhc_state &= ~(XHCI_STATE_HALTED | XHCI_STATE_DYING); | 150 | /* clear state flags. Including dying, halted or removing */ |
151 | xhci->xhc_state = 0; | ||
151 | 152 | ||
152 | return ret; | 153 | return ret; |
153 | } | 154 | } |
@@ -2773,7 +2774,8 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | |||
2773 | if (ret <= 0) | 2774 | if (ret <= 0) |
2774 | return ret; | 2775 | return ret; |
2775 | xhci = hcd_to_xhci(hcd); | 2776 | xhci = hcd_to_xhci(hcd); |
2776 | if (xhci->xhc_state & XHCI_STATE_DYING) | 2777 | if ((xhci->xhc_state & XHCI_STATE_DYING) || |
2778 | (xhci->xhc_state & XHCI_STATE_REMOVING)) | ||
2777 | return -ENODEV; | 2779 | return -ENODEV; |
2778 | 2780 | ||
2779 | xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); | 2781 | xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); |
@@ -3820,7 +3822,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3820 | 3822 | ||
3821 | mutex_lock(&xhci->mutex); | 3823 | mutex_lock(&xhci->mutex); |
3822 | 3824 | ||
3823 | if (xhci->xhc_state) /* dying or halted */ | 3825 | if (xhci->xhc_state) /* dying, removing or halted */ |
3824 | goto out; | 3826 | goto out; |
3825 | 3827 | ||
3826 | if (!udev->slot_id) { | 3828 | if (!udev->slot_id) { |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 70f215c20b2b..6c629c97f8ad 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1605,6 +1605,7 @@ struct xhci_hcd { | |||
1605 | */ | 1605 | */ |
1606 | #define XHCI_STATE_DYING (1 << 0) | 1606 | #define XHCI_STATE_DYING (1 << 0) |
1607 | #define XHCI_STATE_HALTED (1 << 1) | 1607 | #define XHCI_STATE_HALTED (1 << 1) |
1608 | #define XHCI_STATE_REMOVING (1 << 2) | ||
1608 | /* Statistics */ | 1609 | /* Statistics */ |
1609 | int error_bitmask; | 1610 | int error_bitmask; |
1610 | unsigned int quirks; | 1611 | unsigned int quirks; |