diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2009-08-27 17:35:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:17 -0400 |
commit | 66d1eebce5cca916e0b08d961690bb01c64751ef (patch) | |
tree | 333a0b1e99541b9219bf69fe1a1f3a2f6489ea57 /drivers | |
parent | ac9d8fe7c6a8041cca5a0738915d2c4e21381421 (diff) |
USB: xhci: Make TRB completion code comparison readable.
Use trb_comp_code instead of getting the completion code from the transfer
event every time.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 35374ddc31c1..e876fd372dd1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -874,6 +874,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
874 | struct urb *urb = 0; | 874 | struct urb *urb = 0; |
875 | int status = -EINPROGRESS; | 875 | int status = -EINPROGRESS; |
876 | struct xhci_ep_ctx *ep_ctx; | 876 | struct xhci_ep_ctx *ep_ctx; |
877 | u32 trb_comp_code; | ||
877 | 878 | ||
878 | xhci_dbg(xhci, "In %s\n", __func__); | 879 | xhci_dbg(xhci, "In %s\n", __func__); |
879 | slot_id = TRB_TO_SLOT_ID(event->flags); | 880 | slot_id = TRB_TO_SLOT_ID(event->flags); |
@@ -931,7 +932,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
931 | (unsigned int) event->flags); | 932 | (unsigned int) event->flags); |
932 | 933 | ||
933 | /* Look for common error cases */ | 934 | /* Look for common error cases */ |
934 | switch (GET_COMP_CODE(event->transfer_len)) { | 935 | trb_comp_code = GET_COMP_CODE(event->transfer_len); |
936 | switch (trb_comp_code) { | ||
935 | /* Skip codes that require special handling depending on | 937 | /* Skip codes that require special handling depending on |
936 | * transfer type | 938 | * transfer type |
937 | */ | 939 | */ |
@@ -974,7 +976,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
974 | /* Was this a control transfer? */ | 976 | /* Was this a control transfer? */ |
975 | if (usb_endpoint_xfer_control(&td->urb->ep->desc)) { | 977 | if (usb_endpoint_xfer_control(&td->urb->ep->desc)) { |
976 | xhci_debug_trb(xhci, xhci->event_ring->dequeue); | 978 | xhci_debug_trb(xhci, xhci->event_ring->dequeue); |
977 | switch (GET_COMP_CODE(event->transfer_len)) { | 979 | switch (trb_comp_code) { |
978 | case COMP_SUCCESS: | 980 | case COMP_SUCCESS: |
979 | if (event_trb == ep_ring->dequeue) { | 981 | if (event_trb == ep_ring->dequeue) { |
980 | xhci_warn(xhci, "WARN: Success on ctrl setup TRB without IOC set??\n"); | 982 | xhci_warn(xhci, "WARN: Success on ctrl setup TRB without IOC set??\n"); |
@@ -1031,7 +1033,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
1031 | } | 1033 | } |
1032 | } else { | 1034 | } else { |
1033 | /* Maybe the event was for the data stage? */ | 1035 | /* Maybe the event was for the data stage? */ |
1034 | if (GET_COMP_CODE(event->transfer_len) != COMP_STOP_INVAL) { | 1036 | if (trb_comp_code != COMP_STOP_INVAL) { |
1035 | /* We didn't stop on a link TRB in the middle */ | 1037 | /* We didn't stop on a link TRB in the middle */ |
1036 | td->urb->actual_length = | 1038 | td->urb->actual_length = |
1037 | td->urb->transfer_buffer_length - | 1039 | td->urb->transfer_buffer_length - |
@@ -1043,7 +1045,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
1043 | } | 1045 | } |
1044 | } | 1046 | } |
1045 | } else { | 1047 | } else { |
1046 | switch (GET_COMP_CODE(event->transfer_len)) { | 1048 | switch (trb_comp_code) { |
1047 | case COMP_SUCCESS: | 1049 | case COMP_SUCCESS: |
1048 | /* Double check that the HW transferred everything. */ | 1050 | /* Double check that the HW transferred everything. */ |
1049 | if (event_trb != td->last_trb) { | 1051 | if (event_trb != td->last_trb) { |
@@ -1120,14 +1122,14 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
1120 | /* If the ring didn't stop on a Link or No-op TRB, add | 1122 | /* If the ring didn't stop on a Link or No-op TRB, add |
1121 | * in the actual bytes transferred from the Normal TRB | 1123 | * in the actual bytes transferred from the Normal TRB |
1122 | */ | 1124 | */ |
1123 | if (GET_COMP_CODE(event->transfer_len) != COMP_STOP_INVAL) | 1125 | if (trb_comp_code != COMP_STOP_INVAL) |
1124 | td->urb->actual_length += | 1126 | td->urb->actual_length += |
1125 | TRB_LEN(cur_trb->generic.field[2]) - | 1127 | TRB_LEN(cur_trb->generic.field[2]) - |
1126 | TRB_LEN(event->transfer_len); | 1128 | TRB_LEN(event->transfer_len); |
1127 | } | 1129 | } |
1128 | } | 1130 | } |
1129 | if (GET_COMP_CODE(event->transfer_len) == COMP_STOP_INVAL || | 1131 | if (trb_comp_code == COMP_STOP_INVAL || |
1130 | GET_COMP_CODE(event->transfer_len) == COMP_STOP) { | 1132 | trb_comp_code == COMP_STOP) { |
1131 | /* The Endpoint Stop Command completion will take care of any | 1133 | /* The Endpoint Stop Command completion will take care of any |
1132 | * stopped TDs. A stopped TD may be restarted, so don't update | 1134 | * stopped TDs. A stopped TD may be restarted, so don't update |
1133 | * the ring dequeue pointer or take this TD off any lists yet. | 1135 | * the ring dequeue pointer or take this TD off any lists yet. |