aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-ring.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r--drivers/usb/host/xhci-ring.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8275645889da..643c2f3f3e73 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -145,29 +145,37 @@ static void next_trb(struct xhci_hcd *xhci,
145 */ 145 */
146static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) 146static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
147{ 147{
148 union xhci_trb *next;
149 unsigned long long addr; 148 unsigned long long addr;
150 149
151 ring->deq_updates++; 150 ring->deq_updates++;
152 151
153 /* If this is not event ring, there is one more usable TRB */ 152 /*
153 * If this is not event ring, and the dequeue pointer
154 * is not on a link TRB, there is one more usable TRB
155 */
154 if (ring->type != TYPE_EVENT && 156 if (ring->type != TYPE_EVENT &&
155 !last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) 157 !last_trb(xhci, ring, ring->deq_seg, ring->dequeue))
156 ring->num_trbs_free++; 158 ring->num_trbs_free++;
157 next = ++(ring->dequeue);
158 159
159 /* Update the dequeue pointer further if that was a link TRB or we're at 160 do {
160 * the end of an event ring segment (which doesn't have link TRBS) 161 /*
161 */ 162 * Update the dequeue pointer further if that was a link TRB or
162 while (last_trb(xhci, ring, ring->deq_seg, next)) { 163 * we're at the end of an event ring segment (which doesn't have
163 if (ring->type == TYPE_EVENT && last_trb_on_last_seg(xhci, 164 * link TRBS)
164 ring, ring->deq_seg, next)) { 165 */
165 ring->cycle_state = (ring->cycle_state ? 0 : 1); 166 if (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) {
167 if (ring->type == TYPE_EVENT &&
168 last_trb_on_last_seg(xhci, ring,
169 ring->deq_seg, ring->dequeue)) {
170 ring->cycle_state = (ring->cycle_state ? 0 : 1);
171 }
172 ring->deq_seg = ring->deq_seg->next;
173 ring->dequeue = ring->deq_seg->trbs;
174 } else {
175 ring->dequeue++;
166 } 176 }
167 ring->deq_seg = ring->deq_seg->next; 177 } while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue));
168 ring->dequeue = ring->deq_seg->trbs; 178
169 next = ring->dequeue;
170 }
171 addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); 179 addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
172} 180}
173 181
@@ -2073,8 +2081,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2073 if (xhci->quirks & XHCI_TRUST_TX_LENGTH) 2081 if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
2074 trb_comp_code = COMP_SHORT_TX; 2082 trb_comp_code = COMP_SHORT_TX;
2075 else 2083 else
2076 xhci_warn(xhci, "WARN Successful completion on short TX: " 2084 xhci_warn_ratelimited(xhci,
2077 "needs XHCI_TRUST_TX_LENGTH quirk?\n"); 2085 "WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n");
2078 case COMP_SHORT_TX: 2086 case COMP_SHORT_TX:
2079 break; 2087 break;
2080 case COMP_STOP: 2088 case COMP_STOP: