diff options
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r-- | drivers/usb/host/xhci.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 763f484bc092..1c4432d8fc10 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -345,7 +345,8 @@ static void xhci_event_ring_work(unsigned long arg) | |||
345 | spin_lock_irqsave(&xhci->lock, flags); | 345 | spin_lock_irqsave(&xhci->lock, flags); |
346 | temp = xhci_readl(xhci, &xhci->op_regs->status); | 346 | temp = xhci_readl(xhci, &xhci->op_regs->status); |
347 | xhci_dbg(xhci, "op reg status = 0x%x\n", temp); | 347 | xhci_dbg(xhci, "op reg status = 0x%x\n", temp); |
348 | if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING)) { | 348 | if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) || |
349 | (xhci->xhc_state & XHCI_STATE_HALTED)) { | ||
349 | xhci_dbg(xhci, "HW died, polling stopped.\n"); | 350 | xhci_dbg(xhci, "HW died, polling stopped.\n"); |
350 | spin_unlock_irqrestore(&xhci->lock, flags); | 351 | spin_unlock_irqrestore(&xhci->lock, flags); |
351 | return; | 352 | return; |
@@ -939,8 +940,11 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, | |||
939 | return 0; | 940 | return 0; |
940 | } | 941 | } |
941 | 942 | ||
943 | xhci = hcd_to_xhci(hcd); | ||
944 | if (xhci->xhc_state & XHCI_STATE_HALTED) | ||
945 | return -ENODEV; | ||
946 | |||
942 | if (check_virt_dev) { | 947 | if (check_virt_dev) { |
943 | xhci = hcd_to_xhci(hcd); | ||
944 | if (!udev->slot_id || !xhci->devs | 948 | if (!udev->slot_id || !xhci->devs |
945 | || !xhci->devs[udev->slot_id]) { | 949 | || !xhci->devs[udev->slot_id]) { |
946 | printk(KERN_DEBUG "xHCI %s called with unaddressed " | 950 | printk(KERN_DEBUG "xHCI %s called with unaddressed " |
@@ -1242,7 +1246,8 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1242 | xhci_urb_free_priv(xhci, urb_priv); | 1246 | xhci_urb_free_priv(xhci, urb_priv); |
1243 | return ret; | 1247 | return ret; |
1244 | } | 1248 | } |
1245 | if (xhci->xhc_state & XHCI_STATE_DYING) { | 1249 | if ((xhci->xhc_state & XHCI_STATE_DYING) || |
1250 | (xhci->xhc_state & XHCI_STATE_HALTED)) { | ||
1246 | xhci_dbg(xhci, "Ep 0x%x: URB %p to be canceled on " | 1251 | xhci_dbg(xhci, "Ep 0x%x: URB %p to be canceled on " |
1247 | "non-responsive xHCI host.\n", | 1252 | "non-responsive xHCI host.\n", |
1248 | urb->ep->desc.bEndpointAddress, urb); | 1253 | urb->ep->desc.bEndpointAddress, urb); |
@@ -2665,7 +2670,10 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2665 | int i, ret; | 2670 | int i, ret; |
2666 | 2671 | ||
2667 | ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); | 2672 | ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); |
2668 | if (ret <= 0) | 2673 | /* If the host is halted due to driver unload, we still need to free the |
2674 | * device. | ||
2675 | */ | ||
2676 | if (ret <= 0 && ret != -ENODEV) | ||
2669 | return; | 2677 | return; |
2670 | 2678 | ||
2671 | virt_dev = xhci->devs[udev->slot_id]; | 2679 | virt_dev = xhci->devs[udev->slot_id]; |
@@ -2679,7 +2687,8 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2679 | spin_lock_irqsave(&xhci->lock, flags); | 2687 | spin_lock_irqsave(&xhci->lock, flags); |
2680 | /* Don't disable the slot if the host controller is dead. */ | 2688 | /* Don't disable the slot if the host controller is dead. */ |
2681 | state = xhci_readl(xhci, &xhci->op_regs->status); | 2689 | state = xhci_readl(xhci, &xhci->op_regs->status); |
2682 | if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING)) { | 2690 | if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) || |
2691 | (xhci->xhc_state & XHCI_STATE_HALTED)) { | ||
2683 | xhci_free_virt_device(xhci, udev->slot_id); | 2692 | xhci_free_virt_device(xhci, udev->slot_id); |
2684 | spin_unlock_irqrestore(&xhci->lock, flags); | 2693 | spin_unlock_irqrestore(&xhci->lock, flags); |
2685 | return; | 2694 | return; |