summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2009-04-29 19:05:58 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-15 21:44:50 -0700
commitb7116ebca4e1a898f30ae474151fd6474327257c (patch)
treec450c38cfc8464613e08cd3903f4b5d730b75549 /drivers/usb
parentc96a2b81f3747e6924307714666aa2368bc1718b (diff)
downloadtalos-obmc-linux-b7116ebca4e1a898f30ae474151fd6474327257c.tar.gz
talos-obmc-linux-b7116ebca4e1a898f30ae474151fd6474327257c.zip
USB: xhci: Avoid compiler reordering in Link TRB giveback.
Force the compiler to write the cycle bit of the Link TRB last. This ensures that the hardware doesn't think it owns the Link TRB before we set the chain bit. Reported by Oliver in this thread: http://marc.info/?l=linux-usb&m=124091532410219&w=2 Reported-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci-ring.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f692e74f269c..d42a738cdaa7 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -183,13 +183,14 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer
while (last_trb(xhci, ring, ring->enq_seg, next)) {
if (!consumer) {
if (ring != xhci->event_ring) {
+ next->link.control &= ~TRB_CHAIN;
+ next->link.control |= chain;
/* Give this link TRB to the hardware */
+ wmb();
if (next->link.control & TRB_CYCLE)
next->link.control &= (u32) ~TRB_CYCLE;
else
next->link.control |= (u32) TRB_CYCLE;
- next->link.control &= ~TRB_CHAIN;
- next->link.control |= chain;
}
/* Toggle the cycle bit after the last ring segment. */
if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
OpenPOWER on IntegriCloud