aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-09-09 06:29:56 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2013-10-16 15:24:34 -0400
commite7a79a1d6af31c050b4264099c4ab0cbee9122b8 (patch)
treea0f465ca79bc54f0ad331ec847421d0f36c8e528 /drivers/usb/host
parent6ed46d3337b1f4a8f9fa7438589cab5f1bb75e98 (diff)
xhci: add variable 'cmd_comp_code' in handle_cmd_completion()
This patch adds a new variable 'cmd_comp_code' to hold the command completion status code aiming to reduce code duplication and to improve code readability. Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci-ring.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3e8053284752..6826ee1fb125 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1519,6 +1519,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1519 int slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags)); 1519 int slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
1520 u64 cmd_dma; 1520 u64 cmd_dma;
1521 dma_addr_t cmd_dequeue_dma; 1521 dma_addr_t cmd_dequeue_dma;
1522 u32 cmd_comp_code;
1522 1523
1523 cmd_dma = le64_to_cpu(event->cmd_trb); 1524 cmd_dma = le64_to_cpu(event->cmd_trb);
1524 cmd_dequeue_dma = xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, 1525 cmd_dequeue_dma = xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg,
@@ -1537,16 +1538,15 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1537 trace_xhci_cmd_completion(&xhci->cmd_ring->dequeue->generic, 1538 trace_xhci_cmd_completion(&xhci->cmd_ring->dequeue->generic,
1538 (struct xhci_generic_trb *) event); 1539 (struct xhci_generic_trb *) event);
1539 1540
1540 if ((GET_COMP_CODE(le32_to_cpu(event->status)) == COMP_CMD_ABORT) || 1541 cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status));
1541 (GET_COMP_CODE(le32_to_cpu(event->status)) == COMP_CMD_STOP)) { 1542 if (cmd_comp_code == COMP_CMD_ABORT || cmd_comp_code == COMP_CMD_STOP) {
1542 /* If the return value is 0, we think the trb pointed by 1543 /* If the return value is 0, we think the trb pointed by
1543 * command ring dequeue pointer is a good trb. The good 1544 * command ring dequeue pointer is a good trb. The good
1544 * trb means we don't want to cancel the trb, but it have 1545 * trb means we don't want to cancel the trb, but it have
1545 * been stopped by host. So we should handle it normally. 1546 * been stopped by host. So we should handle it normally.
1546 * Otherwise, driver should invoke inc_deq() and return. 1547 * Otherwise, driver should invoke inc_deq() and return.
1547 */ 1548 */
1548 if (handle_stopped_cmd_ring(xhci, 1549 if (handle_stopped_cmd_ring(xhci, cmd_comp_code)) {
1549 GET_COMP_CODE(le32_to_cpu(event->status)))) {
1550 inc_deq(xhci, xhci->cmd_ring); 1550 inc_deq(xhci, xhci->cmd_ring);
1551 return; 1551 return;
1552 } 1552 }
@@ -1561,23 +1561,19 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1561 switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3]) 1561 switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])
1562 & TRB_TYPE_BITMASK) { 1562 & TRB_TYPE_BITMASK) {
1563 case TRB_TYPE(TRB_ENABLE_SLOT): 1563 case TRB_TYPE(TRB_ENABLE_SLOT):
1564 xhci_handle_cmd_enable_slot(xhci, slot_id, 1564 xhci_handle_cmd_enable_slot(xhci, slot_id, cmd_comp_code);
1565 GET_COMP_CODE(le32_to_cpu(event->status)));
1566 break; 1565 break;
1567 case TRB_TYPE(TRB_DISABLE_SLOT): 1566 case TRB_TYPE(TRB_DISABLE_SLOT):
1568 xhci_handle_cmd_disable_slot(xhci, slot_id); 1567 xhci_handle_cmd_disable_slot(xhci, slot_id);
1569 break; 1568 break;
1570 case TRB_TYPE(TRB_CONFIG_EP): 1569 case TRB_TYPE(TRB_CONFIG_EP):
1571 xhci_handle_cmd_config_ep(xhci, slot_id, event, 1570 xhci_handle_cmd_config_ep(xhci, slot_id, event, cmd_comp_code);
1572 GET_COMP_CODE(le32_to_cpu(event->status)));
1573 break; 1571 break;
1574 case TRB_TYPE(TRB_EVAL_CONTEXT): 1572 case TRB_TYPE(TRB_EVAL_CONTEXT):
1575 xhci_handle_cmd_eval_ctx(xhci, slot_id, event, 1573 xhci_handle_cmd_eval_ctx(xhci, slot_id, event, cmd_comp_code);
1576 GET_COMP_CODE(le32_to_cpu(event->status)));
1577 break; 1574 break;
1578 case TRB_TYPE(TRB_ADDR_DEV): 1575 case TRB_TYPE(TRB_ADDR_DEV):
1579 xhci_handle_cmd_addr_dev(xhci, slot_id, 1576 xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code);
1580 GET_COMP_CODE(le32_to_cpu(event->status)));
1581 break; 1577 break;
1582 case TRB_TYPE(TRB_STOP_RING): 1578 case TRB_TYPE(TRB_STOP_RING):
1583 xhci_handle_cmd_stop_ep(xhci, xhci->cmd_ring->dequeue, event); 1579 xhci_handle_cmd_stop_ep(xhci, xhci->cmd_ring->dequeue, event);