[PATCH] usb: host: xhci: fix HALTED endpoint handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the HW reports the endpoint as Halted, there's
no need to start any URB for that endpoint, we can
simply return -EPIPE and this will tell upper layers
that the endpoint is, indeed, halted.

This patch fixes usbtest's set/clear halt test #13
on xHCI-based hosts.

Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---

Hi Sarah,

seems like this has been broken for quite a long
time.

I tested the patch on an AM437x which has XHCI Host and
the same IP configured as device as well (two dwc3 instances,
basically).

It has been running for the past hour or so without any failures
when running testusb -t 13 -c 5000 -s 2048 -a in a loop, but
if you think there's a better way to fix this, let me know. I just
didn't understand why xhci-hcd still queues the URB even though
HW already told us the endpoint is halted. Any comments ?

cheers

 drivers/usb/host/xhci-ring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 53c2e29..e9df61a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2959,7 +2959,8 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
 		/* XXX not sure if this should be -ENOENT or not */
 		return -EINVAL;
 	case EP_STATE_HALTED:
-		xhci_dbg(xhci, "WARN halted endpoint, queueing URB anyway.\n");
+		xhci_dbg(xhci, "WARN halted endpoint.\n");
+		return -EPIPE;
 	case EP_STATE_STOPPED:
 	case EP_STATE_RUNNING:
 		break;
-- 
1.8.4.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux