aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-ring.c
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-09-09 06:29:47 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2013-10-16 15:24:25 -0400
commitb244b431f89e152dd4bf35d71786f1c0eb8cba7e (patch)
treeef173810ae193489ed03531f214408c59ecf297b /drivers/usb/host/xhci-ring.c
parent60b9593cf225827b6b887db4061ea9ece052fbf3 (diff)
xhci: refactor TRB_ENABLE_SLOT case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_ENABLE_SLOT switch case in handle_cmd_completion() into a fuction named xhci_handle_cmd_enable_slot(). Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r--drivers/usb/host/xhci-ring.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f5d504740281..4cad420d7708 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1384,6 +1384,16 @@ static int handle_stopped_cmd_ring(struct xhci_hcd *xhci,
1384 return cur_trb_is_good; 1384 return cur_trb_is_good;
1385} 1385}
1386 1386
1387static void xhci_handle_cmd_enable_slot(struct xhci_hcd *xhci, int slot_id,
1388 u32 cmd_comp_code)
1389{
1390 if (cmd_comp_code == COMP_SUCCESS)
1391 xhci->slot_id = slot_id;
1392 else
1393 xhci->slot_id = 0;
1394 complete(&xhci->addr_dev);
1395}
1396
1387static void handle_cmd_completion(struct xhci_hcd *xhci, 1397static void handle_cmd_completion(struct xhci_hcd *xhci,
1388 struct xhci_event_cmd *event) 1398 struct xhci_event_cmd *event)
1389{ 1399{
@@ -1437,11 +1447,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1437 switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3]) 1447 switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])
1438 & TRB_TYPE_BITMASK) { 1448 & TRB_TYPE_BITMASK) {
1439 case TRB_TYPE(TRB_ENABLE_SLOT): 1449 case TRB_TYPE(TRB_ENABLE_SLOT):
1440 if (GET_COMP_CODE(le32_to_cpu(event->status)) == COMP_SUCCESS) 1450 xhci_handle_cmd_enable_slot(xhci, slot_id,
1441 xhci->slot_id = slot_id; 1451 GET_COMP_CODE(le32_to_cpu(event->status)));
1442 else
1443 xhci->slot_id = 0;
1444 complete(&xhci->addr_dev);
1445 break; 1452 break;
1446 case TRB_TYPE(TRB_DISABLE_SLOT): 1453 case TRB_TYPE(TRB_DISABLE_SLOT):
1447 if (xhci->devs[slot_id]) { 1454 if (xhci->devs[slot_id]) {