]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xhci: unify cycle state toggling operation with 'XOR'
authorLin Wang <lin.x.wang@intel.com>
Tue, 17 Mar 2015 16:32:21 +0000 (18:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2015 15:21:14 +0000 (16:21 +0100)
Some toggling operation in xHCI driver still use conditional toggling:
ring->cycle_state = (ring->cycle_state ? 0 : 1);

Use XOR to invert the cycle state instead of a conditional toggle to unify
cycle state toggling operation in xHCI driver.

Signed-off-by: Lin Wang <lin.x.wang@intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c

index 5fb66db89e05549da9cd4e94a15abbbcc3ba5a19..da2ff5097fcf238f30a49b102a814e9368d71842 100644 (file)
@@ -238,7 +238,7 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,
 
                        /* Toggle the cycle bit after the last ring segment. */
                        if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
-                               ring->cycle_state = (ring->cycle_state ? 0 : 1);
+                               ring->cycle_state ^= 1;
                        }
                }
                ring->enq_seg = ring->enq_seg->next;
@@ -2809,7 +2809,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
 
                        /* Toggle the cycle bit after the last ring segment. */
                        if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
-                               ring->cycle_state = (ring->cycle_state ? 0 : 1);
+                               ring->cycle_state ^= 1;
                        }
                        ring->enq_seg = ring->enq_seg->next;
                        ring->enqueue = ring->enq_seg->trbs;