aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2011-02-23 21:13:43 -0500
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2011-03-13 21:23:56 -0400
commitba0a4d9aaae789a6a632968b27c21d49b858b13a (patch)
tree22e76438fe70720fa89d683586009cc028bceb0e /drivers/usb
parent01a1fdb9a7afa5e3c14c9316d6f380732750b4e4 (diff)
xhci: Clean up cycle bit math used during stalls.
Use XOR to invert the cycle bit, instead of a more complicated calculation. Eliminate a check for the link TRB type in find_trb_seg(). We know that there will always be a link TRB at the end of a segment, so xhci_segment->trbs[TRBS_PER_SEGMENT - 1] will always have a link TRB type. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Tested-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci-ring.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index cf86eb70a62e..032af7e8a6bf 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -380,10 +380,8 @@ static struct xhci_segment *find_trb_seg(
380 while (cur_seg->trbs > trb || 380 while (cur_seg->trbs > trb ||
381 &cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) { 381 &cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {
382 generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic; 382 generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic;
383 if ((generic_trb->field[3] & TRB_TYPE_BITMASK) == 383 if (generic_trb->field[3] & LINK_TOGGLE)
384 TRB_TYPE(TRB_LINK) && 384 *cycle_state ^= 0x1;
385 (generic_trb->field[3] & LINK_TOGGLE))
386 *cycle_state = ~(*cycle_state) & 0x1;
387 cur_seg = cur_seg->next; 385 cur_seg = cur_seg->next;
388 if (cur_seg == start_seg) 386 if (cur_seg == start_seg)
389 /* Looped over the entire list. Oops! */ 387 /* Looped over the entire list. Oops! */
@@ -492,7 +490,7 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
492 trb = &state->new_deq_ptr->generic; 490 trb = &state->new_deq_ptr->generic;
493 if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && 491 if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) &&
494 (trb->field[3] & LINK_TOGGLE)) 492 (trb->field[3] & LINK_TOGGLE))
495 state->new_cycle_state = ~(state->new_cycle_state) & 0x1; 493 state->new_cycle_state ^= 0x1;
496 next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr); 494 next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr);
497 495
498 /* 496 /*