diff options
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r-- | drivers/usb/host/xhci.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d5c550ea3e68..96ef552cfeb3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -508,9 +508,10 @@ void xhci_stop(struct usb_hcd *hcd) | |||
508 | spin_lock_irq(&xhci->lock); | 508 | spin_lock_irq(&xhci->lock); |
509 | xhci_halt(xhci); | 509 | xhci_halt(xhci); |
510 | xhci_reset(xhci); | 510 | xhci_reset(xhci); |
511 | xhci_cleanup_msix(xhci); | ||
512 | spin_unlock_irq(&xhci->lock); | 511 | spin_unlock_irq(&xhci->lock); |
513 | 512 | ||
513 | xhci_cleanup_msix(xhci); | ||
514 | |||
514 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 515 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
515 | /* Tell the event ring poll function not to reschedule */ | 516 | /* Tell the event ring poll function not to reschedule */ |
516 | xhci->zombie = 1; | 517 | xhci->zombie = 1; |
@@ -544,9 +545,10 @@ void xhci_shutdown(struct usb_hcd *hcd) | |||
544 | 545 | ||
545 | spin_lock_irq(&xhci->lock); | 546 | spin_lock_irq(&xhci->lock); |
546 | xhci_halt(xhci); | 547 | xhci_halt(xhci); |
547 | xhci_cleanup_msix(xhci); | ||
548 | spin_unlock_irq(&xhci->lock); | 548 | spin_unlock_irq(&xhci->lock); |
549 | 549 | ||
550 | xhci_cleanup_msix(xhci); | ||
551 | |||
550 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", | 552 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", |
551 | xhci_readl(xhci, &xhci->op_regs->status)); | 553 | xhci_readl(xhci, &xhci->op_regs->status)); |
552 | } | 554 | } |
@@ -1284,6 +1286,15 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | |||
1284 | cmd_completion = command->completion; | 1286 | cmd_completion = command->completion; |
1285 | cmd_status = &command->status; | 1287 | cmd_status = &command->status; |
1286 | command->command_trb = xhci->cmd_ring->enqueue; | 1288 | command->command_trb = xhci->cmd_ring->enqueue; |
1289 | |||
1290 | /* Enqueue pointer can be left pointing to the link TRB, | ||
1291 | * we must handle that | ||
1292 | */ | ||
1293 | if ((command->command_trb->link.control & TRB_TYPE_BITMASK) | ||
1294 | == TRB_TYPE(TRB_LINK)) | ||
1295 | command->command_trb = | ||
1296 | xhci->cmd_ring->enq_seg->next->trbs; | ||
1297 | |||
1287 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); | 1298 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); |
1288 | } else { | 1299 | } else { |
1289 | in_ctx = virt_dev->in_ctx; | 1300 | in_ctx = virt_dev->in_ctx; |
@@ -1993,6 +2004,15 @@ int xhci_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
1993 | /* Attempt to submit the Reset Device command to the command ring */ | 2004 | /* Attempt to submit the Reset Device command to the command ring */ |
1994 | spin_lock_irqsave(&xhci->lock, flags); | 2005 | spin_lock_irqsave(&xhci->lock, flags); |
1995 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; | 2006 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; |
2007 | |||
2008 | /* Enqueue pointer can be left pointing to the link TRB, | ||
2009 | * we must handle that | ||
2010 | */ | ||
2011 | if ((reset_device_cmd->command_trb->link.control & TRB_TYPE_BITMASK) | ||
2012 | == TRB_TYPE(TRB_LINK)) | ||
2013 | reset_device_cmd->command_trb = | ||
2014 | xhci->cmd_ring->enq_seg->next->trbs; | ||
2015 | |||
1996 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); | 2016 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); |
1997 | ret = xhci_queue_reset_device(xhci, slot_id); | 2017 | ret = xhci_queue_reset_device(xhci, slot_id); |
1998 | if (ret) { | 2018 | if (ret) { |
@@ -2148,8 +2168,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2148 | xhci_err(xhci, "Error while assigning device slot ID\n"); | 2168 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
2149 | return 0; | 2169 | return 0; |
2150 | } | 2170 | } |
2151 | /* xhci_alloc_virt_device() does not touch rings; no need to lock */ | 2171 | /* xhci_alloc_virt_device() does not touch rings; no need to lock. |
2152 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { | 2172 | * Use GFP_NOIO, since this function can be called from |
2173 | * xhci_discover_or_reset_device(), which may be called as part of | ||
2174 | * mass storage driver error handling. | ||
2175 | */ | ||
2176 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { | ||
2153 | /* Disable slot, if we can do it without mem alloc */ | 2177 | /* Disable slot, if we can do it without mem alloc */ |
2154 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); | 2178 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
2155 | spin_lock_irqsave(&xhci->lock, flags); | 2179 | spin_lock_irqsave(&xhci->lock, flags); |