blob: 1a0c1926cc4e97b9807b7f44f9b69f7587f110bc [file] [log] [blame]
From 39c396a88f7e74af27f0379390bd86a9abce7c52 Mon Sep 17 00:00:00 2001
From: Mathias Nyman <mathias.nyman@linux.intel.com>
Date: Fri, 11 Nov 2016 15:13:15 +0200
Subject: [PATCH 279/299] xhci: remove extra URB_SHORT_NOT_OK checks in xhci,
core handles most cases
We only check for the URB_SHORT_NOT_OK urb flag to set the urb status
to -EREMOTEIO for transfers that didn't transfer all data.
This will be done in __usb_hcd_giveback() for other than isoc tranfers,
so remove the redundant check from xhci.
Also fix a couple split lines in debug messages to make them greppable.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 52ab86852f74c21a8f7fc5f2eb7f70b81d99eb99)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/usb/host/xhci-ring.c | 54 +++++--------------------------------------
1 file changed, 7 insertions(+), 47 deletions(-)
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1921,9 +1921,6 @@ td_cleanup:
urb->transfer_buffer_length,
urb->actual_length);
urb->actual_length = 0;
- if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
- *status = -EREMOTEIO;
- else
*status = 0;
}
list_del_init(&td->td_list);
@@ -1983,9 +1980,6 @@ static int process_ctrl_td(struct xhci_h
}
break;
case COMP_SHORT_TX:
- if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
- *status = -EREMOTEIO;
- else
*status = 0;
break;
case COMP_STOP_SHORT:
@@ -2032,16 +2026,7 @@ static int process_ctrl_td(struct xhci_h
if (event_trb != ep_ring->dequeue) {
/* The event was for the status stage */
if (event_trb == td->last_trb) {
- if (td->urb_length_set) {
- /* Don't overwrite a previously set error code
- */
- if ((*status == -EINPROGRESS || *status == 0) &&
- (td->urb->transfer_flags
- & URB_SHORT_NOT_OK))
- /* Did we already see a short data
- * stage? */
- *status = -EREMOTEIO;
- } else {
+ if (!td->urb_length_set) {
td->urb->actual_length =
td->urb->transfer_buffer_length;
}
@@ -2205,24 +2190,15 @@ static int process_bulk_intr_td(struct x
/* Double check that the HW transferred everything. */
if (event_trb != td->last_trb ||
EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
- xhci_warn(xhci, "WARN Successful completion "
- "on short TX\n");
- if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
- *status = -EREMOTEIO;
- else
- *status = 0;
+ xhci_warn(xhci, "WARN Successful completion on short TX\n");
if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
trb_comp_code = COMP_SHORT_TX;
- } else {
- *status = 0;
}
+ *status = 0;
break;
case COMP_STOP_SHORT:
case COMP_SHORT_TX:
- if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
- *status = -EREMOTEIO;
- else
- *status = 0;
+ *status = 0;
break;
default:
/* Others already handled above */
@@ -2254,29 +2230,13 @@ static int process_bulk_intr_td(struct x
EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
if (td->urb->transfer_buffer_length <
td->urb->actual_length) {
- xhci_warn(xhci, "HC gave bad length "
- "of %d bytes left\n",
+ xhci_warn(xhci, "HC gave bad length of %d bytes left\n",
EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)));
td->urb->actual_length = 0;
- if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
- *status = -EREMOTEIO;
- else
- *status = 0;
+ *status = 0;
}
/* Don't overwrite a previously set error code */
- if (*status == -EINPROGRESS) {
- if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
- *status = -EREMOTEIO;
- else
- *status = 0;
- }
- } else {
- td->urb->actual_length =
- td->urb->transfer_buffer_length;
- /* Ignore a short packet completion if the
- * untransferred length was zero.
- */
- if (*status == -EREMOTEIO)
+ if (*status == -EINPROGRESS)
*status = 0;
}
} else {