summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorXenia Ragiadakou2013-09-09 12:29:47 +0200
committerSarah Sharp2013-10-16 21:24:25 +0200
commitb244b431f89e152dd4bf35d71786f1c0eb8cba7e (patch)
treeef173810ae193489ed03531f214408c59ecf297b /drivers/usb
parentxhci: rename existing Command Completion Event handlers (diff)
downloadkernel-qcow2-linux-b244b431f89e152dd4bf35d71786f1c0eb8cba7e.tar.gz
kernel-qcow2-linux-b244b431f89e152dd4bf35d71786f1c0eb8cba7e.tar.xz
kernel-qcow2-linux-b244b431f89e152dd4bf35d71786f1c0eb8cba7e.zip
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')
-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,
return cur_trb_is_good;
}
+static void xhci_handle_cmd_enable_slot(struct xhci_hcd *xhci, int slot_id,
+ u32 cmd_comp_code)
+{
+ if (cmd_comp_code == COMP_SUCCESS)
+ xhci->slot_id = slot_id;
+ else
+ xhci->slot_id = 0;
+ complete(&xhci->addr_dev);
+}
+
static void handle_cmd_completion(struct xhci_hcd *xhci,
struct xhci_event_cmd *event)
{
@@ -1437,11 +1447,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])
& TRB_TYPE_BITMASK) {
case TRB_TYPE(TRB_ENABLE_SLOT):
- if (GET_COMP_CODE(le32_to_cpu(event->status)) == COMP_SUCCESS)
- xhci->slot_id = slot_id;
- else
- xhci->slot_id = 0;
- complete(&xhci->addr_dev);
+ xhci_handle_cmd_enable_slot(xhci, slot_id,
+ GET_COMP_CODE(le32_to_cpu(event->status)));
break;
case TRB_TYPE(TRB_DISABLE_SLOT):
if (xhci->devs[slot_id]) {