blob: c80d93924ed154e5f9b64665b86597c6a163da62 [file] [log] [blame]
From bab340dadee90112f8d1930e59534d3107a44fcf Mon Sep 17 00:00:00 2001
From: Mathias Nyman <mathias.nyman@linux.intel.com>
Date: Fri, 11 Nov 2016 15:13:18 +0200
Subject: [PATCH 282/299] xhci: rename endpoint related trb variables
Renaming variables, no functional changes
Event trbs on the event ring cointain a pointer to the transfer trb
on a endpoint ring that caused the event.
The naming has been very confusing as the event trb was called "event"
and the endpoint transfer trb was called "event_trb".
rename all variables that are realated to the endpoint transfer trb
from event_* to ep_*
No functional changes
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f97c08ae329bcf0016379235e3f0bd6b8b2adbf9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/usb/host/xhci-ring.c | 77 +++++++++++++++++++++----------------------
1 file changed, 38 insertions(+), 39 deletions(-)
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1787,7 +1787,7 @@ struct xhci_segment *trb_in_td(struct xh
static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
unsigned int slot_id, unsigned int ep_index,
unsigned int stream_id,
- struct xhci_td *td, union xhci_trb *event_trb)
+ struct xhci_td *td, union xhci_trb *ep_trb)
{
struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index];
struct xhci_command *command;
@@ -1852,7 +1852,7 @@ int xhci_is_vendor_info_code(struct xhci
* Return 1 if the urb can be given back.
*/
static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
- union xhci_trb *event_trb, struct xhci_transfer_event *event,
+ union xhci_trb *ep_trb, struct xhci_transfer_event *event,
struct xhci_virt_ep *ep, int *status, bool skip)
{
struct xhci_virt_device *xdev;
@@ -1894,7 +1894,7 @@ static int finish_td(struct xhci_hcd *xh
* The class driver clears the device side halt later.
*/
xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index,
- ep_ring->stream_id, td, event_trb);
+ ep_ring->stream_id, td, ep_trb);
} else {
/* Update ring dequeue pointer */
while (ep_ring->dequeue != td->last_trb)
@@ -1963,7 +1963,7 @@ static int sum_trb_lengths(struct xhci_h
* Process control tds, update urb status and actual_length.
*/
static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
- union xhci_trb *event_trb, struct xhci_transfer_event *event,
+ union xhci_trb *ep_trb, struct xhci_transfer_event *event,
struct xhci_virt_ep *ep, int *status)
{
struct xhci_virt_device *xdev;
@@ -1985,12 +1985,11 @@ static int process_ctrl_td(struct xhci_h
remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
/* not setup (dequeue), or status stage means we are at data stage */
- on_data_stage = (event_trb != ep_ring->dequeue &&
- event_trb != td->last_trb);
+ on_data_stage = (ep_trb != ep_ring->dequeue && ep_trb != td->last_trb);
switch (trb_comp_code) {
case COMP_SUCCESS:
- if (event_trb != td->last_trb) {
+ if (ep_trb != td->last_trb) {
xhci_warn(xhci, "WARN: Success on ctrl %s TRB without IOC set?\n",
on_data_stage ? "data" : "setup");
*status = -ESHUTDOWN;
@@ -2030,7 +2029,7 @@ static int process_ctrl_td(struct xhci_h
}
/* stopped at setup stage, no data transferred */
- if (event_trb == ep_ring->dequeue)
+ if (ep_trb == ep_ring->dequeue)
goto finish_td;
/*
@@ -2049,14 +2048,14 @@ static int process_ctrl_td(struct xhci_h
td->urb->actual_length = requested;
finish_td:
- return finish_td(xhci, td, event_trb, event, ep, status, false);
+ return finish_td(xhci, td, ep_trb, event, ep, status, false);
}
/*
* Process isochronous tds, update urb packet status and actual_length.
*/
static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
- union xhci_trb *event_trb, struct xhci_transfer_event *event,
+ union xhci_trb *ep_trb, struct xhci_transfer_event *event,
struct xhci_virt_ep *ep, int *status)
{
struct xhci_ring *ep_ring;
@@ -2106,7 +2105,7 @@ static int process_isoc_td(struct xhci_h
break;
case COMP_TX_ERR:
frame->status = -EPROTO;
- if (event_trb != td->last_trb)
+ if (ep_trb != td->last_trb)
return 0;
skip_td = true;
break;
@@ -2127,7 +2126,7 @@ static int process_isoc_td(struct xhci_h
td->urb->actual_length += frame->actual_length;
} else {
for (cur_trb = ep_ring->dequeue,
- cur_seg = ep_ring->deq_seg; cur_trb != event_trb;
+ cur_seg = ep_ring->deq_seg; cur_trb != ep_trb;
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
if (!trb_is_noop(cur_trb) && !trb_is_link(cur_trb))
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
@@ -2141,7 +2140,7 @@ static int process_isoc_td(struct xhci_h
}
}
- return finish_td(xhci, td, event_trb, event, ep, status, false);
+ return finish_td(xhci, td, ep_trb, event, ep, status, false);
}
static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
@@ -2176,23 +2175,23 @@ static int skip_isoc_td(struct xhci_hcd
* Process bulk and interrupt tds, update urb status and actual_length.
*/
static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
- union xhci_trb *event_trb, struct xhci_transfer_event *event,
+ union xhci_trb *ep_trb, struct xhci_transfer_event *event,
struct xhci_virt_ep *ep, int *status)
{
struct xhci_ring *ep_ring;
u32 trb_comp_code;
- u32 remaining, requested, event_trb_len;
+ u32 remaining, requested, ep_trb_len;
ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len));
remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
- event_trb_len = TRB_LEN(le32_to_cpu(event_trb->generic.field[2]));
+ ep_trb_len = TRB_LEN(le32_to_cpu(ep_trb->generic.field[2]));
requested = td->urb->transfer_buffer_length;
switch (trb_comp_code) {
case COMP_SUCCESS:
/* handle success with untransferred data as short packet */
- if (event_trb != td->last_trb || remaining) {
+ if (ep_trb != td->last_trb || remaining) {
xhci_warn(xhci, "WARN Successful completion on short TX\n");
xhci_dbg(xhci, "ep %#x - asked for %d bytes, %d bytes untransferred\n",
td->urb->ep->desc.bEndpointAddress,
@@ -2211,7 +2210,7 @@ static int process_bulk_intr_td(struct x
goto finish_td;
case COMP_STOP_INVAL:
/* stopped on ep trb with invalid length, exclude it */
- event_trb_len = 0;
+ ep_trb_len = 0;
remaining = 0;
break;
default:
@@ -2219,19 +2218,19 @@ static int process_bulk_intr_td(struct x
break;
}
- if (event_trb == td->last_trb)
+ if (ep_trb == td->last_trb)
td->urb->actual_length = requested - remaining;
else
td->urb->actual_length =
- sum_trb_lengths(xhci, ep_ring, event_trb) +
- event_trb_len - remaining;
+ sum_trb_lengths(xhci, ep_ring, ep_trb) +
+ ep_trb_len - remaining;
finish_td:
if (remaining > requested) {
xhci_warn(xhci, "bad transfer trb length %d in event trb\n",
remaining);
td->urb->actual_length = 0;
}
- return finish_td(xhci, td, event_trb, event, ep, status, false);
+ return finish_td(xhci, td, ep_trb, event, ep, status, false);
}
/*
@@ -2250,9 +2249,9 @@ static int handle_tx_event(struct xhci_h
unsigned int slot_id;
int ep_index;
struct xhci_td *td = NULL;
- dma_addr_t event_dma;
- struct xhci_segment *event_seg;
- union xhci_trb *event_trb;
+ dma_addr_t ep_trb_dma;
+ struct xhci_segment *ep_seg;
+ union xhci_trb *ep_trb;
struct urb *urb = NULL;
int status = -EINPROGRESS;
struct urb_priv *urb_priv;
@@ -2309,7 +2308,7 @@ static int handle_tx_event(struct xhci_h
td_num++;
}
- event_dma = le64_to_cpu(event->buffer);
+ ep_trb_dma = le64_to_cpu(event->buffer);
trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len));
/* Look for common error cases */
switch (trb_comp_code) {
@@ -2455,8 +2454,8 @@ static int handle_tx_event(struct xhci_h
td_num--;
/* Is this a TRB in the currently executing TD? */
- event_seg = trb_in_td(xhci, ep_ring->deq_seg, ep_ring->dequeue,
- td->last_trb, event_dma, false);
+ ep_seg = trb_in_td(xhci, ep_ring->deq_seg, ep_ring->dequeue,
+ td->last_trb, ep_trb_dma, false);
/*
* Skip the Force Stopped Event. The event_trb(event_dma) of FSE
@@ -2466,13 +2465,13 @@ static int handle_tx_event(struct xhci_h
* last TRB of the previous TD. The command completion handle
* will take care the rest.
*/
- if (!event_seg && (trb_comp_code == COMP_STOP ||
+ if (!ep_seg && (trb_comp_code == COMP_STOP ||
trb_comp_code == COMP_STOP_INVAL)) {
ret = 0;
goto cleanup;
}
- if (!event_seg) {
+ if (!ep_seg) {
if (!ep->skip ||
!usb_endpoint_xfer_isoc(&td->urb->ep->desc)) {
/* Some host controllers give a spurious
@@ -2493,7 +2492,7 @@ static int handle_tx_event(struct xhci_h
trb_comp_code);
trb_in_td(xhci, ep_ring->deq_seg,
ep_ring->dequeue, td->last_trb,
- event_dma, true);
+ ep_trb_dma, true);
return -ESHUTDOWN;
}
@@ -2510,16 +2509,16 @@ static int handle_tx_event(struct xhci_h
ep->skip = false;
}
- event_trb = &event_seg->trbs[(event_dma - event_seg->dma) /
- sizeof(*event_trb)];
+ ep_trb = &ep_seg->trbs[(ep_trb_dma - ep_seg->dma) /
+ sizeof(*ep_trb)];
/*
* No-op TRB should not trigger interrupts.
- * If event_trb is a no-op TRB, it means the
+ * If ep_trb is a no-op TRB, it means the
* corresponding TD has been cancelled. Just ignore
* the TD.
*/
- if (trb_is_noop(event_trb)) {
- xhci_dbg(xhci, "event_trb is a no-op TRB. Skip it\n");
+ if (trb_is_noop(ep_trb)) {
+ xhci_dbg(xhci, "ep_trb is a no-op TRB. Skip it\n");
goto cleanup;
}
@@ -2527,13 +2526,13 @@ static int handle_tx_event(struct xhci_h
* the core
*/
if (usb_endpoint_xfer_control(&td->urb->ep->desc))
- ret = process_ctrl_td(xhci, td, event_trb, event, ep,
+ ret = process_ctrl_td(xhci, td, ep_trb, event, ep,
&status);
else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc))
- ret = process_isoc_td(xhci, td, event_trb, event, ep,
+ ret = process_isoc_td(xhci, td, ep_trb, event, ep,
&status);
else
- ret = process_bulk_intr_td(xhci, td, event_trb, event,
+ ret = process_bulk_intr_td(xhci, td, ep_trb, event,
ep, &status);
cleanup: