linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: gadget: set status of request on every completed trb
@ 2022-03-07 21:46 Michael Grzeschik
  2022-03-08  1:23 ` Thinh Nguyen
  2022-03-08  8:28 ` Sergey Shtylyov
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Grzeschik @ 2022-03-07 21:46 UTC (permalink / raw)
  To: linux-usb; +Cc: balbi, gregkh, Thinh.Nguyen, kernel

Currently the status of the request being completed comes from the
dwc3_event_depevt status. The resulting status will then be applied to
the request on dwc3_gadget_del_and_unmap_request.

This assigned status is not right in every case. Since it is possible
that more requests can be ready on the interrupt handler we have to set
the actual status for every request from the trbstatus instead.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/usb/dwc3/gadget.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index a0c883f19a417c..760af09d6d8ef7 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3171,6 +3171,11 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
 	count = trb->size & DWC3_TRB_SIZE_MASK;
 	req->remaining += count;
 
+	if (DWC3_TRB_SIZE_TRBSTS(trb->size) == DWC3_TRBSTS_MISSED_ISOC)
+		req->request.status = -EXDEV;
+	else if (DWC3_TRB_SIZE_TRBSTS(trb->size) == DWC3_TRBSTS_OK)
+		req->request.status = 0;
+
 	if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
 		return 1;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-08  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 21:46 [PATCH] usb: dwc3: gadget: set status of request on every completed trb Michael Grzeschik
2022-03-08  1:23 ` Thinh Nguyen
2022-03-08  8:28 ` Sergey Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).