|
@@ -2598,15 +2598,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
|
|
|
if (command) {
|
|
|
cmd_completion = command->completion;
|
|
|
cmd_status = &command->status;
|
|
|
- command->command_trb = xhci->cmd_ring->enqueue;
|
|
|
-
|
|
|
- /* Enqueue pointer can be left pointing to the link TRB,
|
|
|
- * we must handle that
|
|
|
- */
|
|
|
- if (TRB_TYPE_LINK_LE32(command->command_trb->link.control))
|
|
|
- command->command_trb =
|
|
|
- xhci->cmd_ring->enq_seg->next->trbs;
|
|
|
-
|
|
|
+ command->command_trb = xhci_find_next_enqueue(xhci->cmd_ring);
|
|
|
list_add_tail(&command->cmd_list, &virt_dev->cmd_list);
|
|
|
} else {
|
|
|
cmd_completion = &virt_dev->cmd_completion;
|
|
@@ -2614,7 +2606,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
|
|
|
}
|
|
|
init_completion(cmd_completion);
|
|
|
|
|
|
- cmd_trb = xhci->cmd_ring->dequeue;
|
|
|
+ cmd_trb = xhci_find_next_enqueue(xhci->cmd_ring);
|
|
|
if (!ctx_change)
|
|
|
ret = xhci_queue_configure_endpoint(xhci, in_ctx->dma,
|
|
|
udev->slot_id, must_succeed);
|
|
@@ -3439,14 +3431,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
|
|
|
|
|
|
/* Attempt to submit the Reset Device command to the command ring */
|
|
|
spin_lock_irqsave(&xhci->lock, flags);
|
|
|
- reset_device_cmd->command_trb = xhci->cmd_ring->enqueue;
|
|
|
-
|
|
|
- /* Enqueue pointer can be left pointing to the link TRB,
|
|
|
- * we must handle that
|
|
|
- */
|
|
|
- if (TRB_TYPE_LINK_LE32(reset_device_cmd->command_trb->link.control))
|
|
|
- reset_device_cmd->command_trb =
|
|
|
- xhci->cmd_ring->enq_seg->next->trbs;
|
|
|
+ reset_device_cmd->command_trb = xhci_find_next_enqueue(xhci->cmd_ring);
|
|
|
|
|
|
list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list);
|
|
|
ret = xhci_queue_reset_device(xhci, slot_id);
|
|
@@ -3650,7 +3635,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
|
|
|
union xhci_trb *cmd_trb;
|
|
|
|
|
|
spin_lock_irqsave(&xhci->lock, flags);
|
|
|
- cmd_trb = xhci->cmd_ring->dequeue;
|
|
|
+ cmd_trb = xhci_find_next_enqueue(xhci->cmd_ring);
|
|
|
ret = xhci_queue_slot_control(xhci, TRB_ENABLE_SLOT, 0);
|
|
|
if (ret) {
|
|
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
|
@@ -3785,7 +3770,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
|
|
|
slot_ctx->dev_info >> 27);
|
|
|
|
|
|
spin_lock_irqsave(&xhci->lock, flags);
|
|
|
- cmd_trb = xhci->cmd_ring->dequeue;
|
|
|
+ cmd_trb = xhci_find_next_enqueue(xhci->cmd_ring);
|
|
|
ret = xhci_queue_address_device(xhci, virt_dev->in_ctx->dma,
|
|
|
udev->slot_id);
|
|
|
if (ret) {
|