[PATCH] usb: dwc3: gadget: fix delayed status missing for clear EP halt

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

 



With several improvements on handling of ClearFeature(halt), there
is one case of delayed status missing: if the xfernotready event
comes after end transfer and clear ep stall command completion,
we can not send the delayed status in dwc3_ep0_send_delayed_status()
as the ep0status is not ready, then in xfernotready event we still
can not send status because delayed_status is still set.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: d97c78a1908e ("usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command")
Signed-off-by: Li Jun <jun.li@xxxxxxx>
---
 drivers/usb/dwc3/ep0.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 7be3903..9580e9f 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -1058,10 +1058,16 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc)
 {
 	unsigned int direction = !dwc->ep0_expect_in;
 
+	/*
+	 * If we are ready to send delayed status
+	 * but wait status pharse, we can clear
+	 * delayed_status flag to let EP0 XferNotReady
+	 * handle it as a normal status sending.
+	 */
+	dwc->delayed_status = false;
 	if (dwc->ep0state != EP0_STATUS_PHASE)
 		return;
 
-	dwc->delayed_status = false;
 	__dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
 }
 
-- 
2.7.4




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

  Powered by Linux