From: Quanyang Wang <[email protected]>

The commit bd7f84708ea02 ("usb: dwc3: gadget: Return proper request
status") loses part of mainline commit. Let's bring it back.

And it fixes the compile warning:
drivers/usb/dwc3/gadget.c:2944:6: warning: unused variable ‘request_status’ 
[-Wunused-variable]
 2944 |  int request_status;
      |      ^~~~~~~~~~~~~~

Signed-off-by: Quanyang Wang <[email protected]>
---
Hi Bruce,
Would you please help merge this patch to the branches:
        v5.10/standard/preempt-rt/sdkv5.10/xlnx-soc
        v5.10/standard/sdkv5.10/xlnx-soc
Thanks,
Quanyang
---
 drivers/usb/dwc3/gadget.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0ddd5536a225f..2bc6d71fb9517 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2973,7 +2973,35 @@ static int 
dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
                }
        }
 
-       dwc3_gadget_giveback(dep, req, status);
+       /*
+        * The event status only reflects the status of the TRB with IOC set.
+        * For the requests that don't set interrupt on completion, the driver
+        * needs to check and return the status of the completed TRBs associated
+        * with the request. Use the status of the last TRB of the request.
+        */
+       if (req->request.no_interrupt) {
+               struct dwc3_trb *trb;
+
+               trb = dwc3_ep_prev_trb(dep, dep->trb_dequeue);
+               switch (DWC3_TRB_SIZE_TRBSTS(trb->size)) {
+               case DWC3_TRBSTS_MISSED_ISOC:
+                       /* Isoc endpoint only */
+                       request_status = -EXDEV;
+                       break;
+               case DWC3_TRB_STS_XFER_IN_PROG:
+                       /* Applicable when End Transfer with ForceRM=0 */
+               case DWC3_TRBSTS_SETUP_PENDING:
+                       /* Control endpoint only */
+               case DWC3_TRBSTS_OK:
+               default:
+                       request_status = 0;
+                       break;
+               }
+       } else {
+               request_status = status;
+       }
+
+       dwc3_gadget_giveback(dep, req, request_status);
 
 out:
        return ret;
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#11347): 
https://lists.yoctoproject.org/g/linux-yocto/message/11347
Mute This Topic: https://lists.yoctoproject.org/mt/91444723/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to