]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: dwc3: gadget: Simplify TRB reclaim logic by removing redundant 'chain' argument
authorJohannes Schneider <johannes.schneider@leica-geosystems.com>
Sun, 29 Jun 2025 09:04:14 +0000 (11:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Jul 2025 09:05:10 +0000 (11:05 +0200)
Now that the TRB reclaim logic always inspects the TRB's CHN (Chain) bit
directly to determine whether a TRB is part of a chain, the explicit
'chain' parameter passed into dwc3_gadget_ep_reclaim_completed_trb()
is no longer necessary.

This cleanup simplifies the reclaim code by avoiding duplication of
chain state tracking, and makes the reclaim logic rely entirely on the
hardware descriptor flags — which are already present and accurate at
this stage.

No functional changes intended.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Link: https://lore.kernel.org/r/20250629090414.294308-2-johannes.schneider@leica-geosystems.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c

index 4a3e97e606d18b9b985e325a4b0c72ff19d82e0c..25db36c63951bf5654f4bf5a98d7073a028364cd 100644 (file)
@@ -3495,7 +3495,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
 
 static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
                struct dwc3_request *req, struct dwc3_trb *trb,
-               const struct dwc3_event_depevt *event, int status, int chain)
+               const struct dwc3_event_depevt *event, int status)
 {
        unsigned int            count;
 
@@ -3547,7 +3547,8 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
        if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
                return 1;
 
-       if (event->status & DEPEVT_STATUS_SHORT && !chain)
+       if (event->status & DEPEVT_STATUS_SHORT &&
+           !(trb->ctrl & DWC3_TRB_CTRL_CHN))
                return 1;
 
        if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) &&
@@ -3574,8 +3575,7 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep,
                trb = &dep->trb_pool[dep->trb_dequeue];
 
                ret = dwc3_gadget_ep_reclaim_completed_trb(dep, req,
-                               trb, event, status,
-                               !!(trb->ctrl & DWC3_TRB_CTRL_CHN));
+                               trb, event, status);
                if (ret)
                        break;
        }