summaryrefslogtreecommitdiff
path: root/drivers/usb/host/xhci-ring.c
diff options
context:
space:
mode:
authorLin Wang <lin.x.wang@intel.com>2015-03-17 18:32:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-18 16:21:14 +0100
commite5401bf37a69620bdf079e4ee6c30a268f06f04b (patch)
treed17949a17d99c022cb88c6602a3146fc9f4076f9 /drivers/usb/host/xhci-ring.c
parent8f7e9473ab62139c78eb834f53c4ec6bc22d111f (diff)
xhci: unify cycle state toggling operation with 'XOR'
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>
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r--drivers/usb/host/xhci-ring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 5fb66db89e05..da2ff5097fcf 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -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;