public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: SCHNEIDER Johannes <johannes.schneider@leica-geosystems.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	GEO-CHHER-bsp-development
	<bsp-development.geo@leica-geosystems.com>
Subject: Re: [PATCH v3] usb: dwc3: gadget: Simplify TRB reclaim logic by removing redundant 'chain' argument
Date: Sun, 29 Jun 2025 11:06:27 +0200	[thread overview]
Message-ID: <2025062945-expose-veteran-3c35@gregkh> (raw)
In-Reply-To: <AM8PR06MB7521915A5FB0DDD1DA38BA3ABC47A@AM8PR06MB7521.eurprd06.prod.outlook.com>

On Sun, Jun 29, 2025 at 08:45:45AM +0000, SCHNEIDER Johannes wrote:
> Hoi Greg,
> 
> 
> > > 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.
> > >
> > > Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
> > > Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> > > ---
> > > v3: no changes, re-submission as single patch
> > > v2: no changes to the patch, "faulty" re-submission
> > > v1: initial submission as part of a series
> > > Link:
> > >
> > >  drivers/usb/dwc3/gadget.c | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > > index 99fbd29d8f46..a4a2bf273f94 100644
> > > --- a/drivers/usb/dwc3/gadget.c
> > > +++ b/drivers/usb/dwc3/gadget.c
> > > @@ -3497,7 +3497,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;
> > >
> > > @@ -3549,7 +3549,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) &&
> > > @@ -3576,8 +3577,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;
> > >       }
> > > --
> > > 2.43.0
> > >
> > 
> > Applying just this patch I get:
> > 
> >   CC [M]  drivers/usb/dwc3/gadget.o
> > drivers/usb/dwc3/gadget.c: In function ‘dwc3_gadget_ep_reclaim_completed_trb’:
> > drivers/usb/dwc3/gadget.c:3517:13: error: ‘chain’ undeclared (first use in this function)
> >  3517 |         if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
> >       |             ^~~~~
> > drivers/usb/dwc3/gadget.c:3517:13: note: each undeclared identifier is reported only once for each function it appears in
> > 
> > So that's not going to work :(
> > 
> 
> Oh - sorry! i shouldn't have pulled the initial series apart :-(
> 
> I'll re-submit both patches together as v4 (this time both with cc-stable)
> ... without b4 to have a new mail tread

The first patch is already in my tree, I can't drop that, sorry.  Just
resend this one on it's own please.

thanks,

greg k-h

  reply	other threads:[~2025-06-29  9:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-21 19:07 [PATCH 0/3] usb: dwc3: Fix TRB reclaim regression and clean up reclaim logic Johannes Schneider
2025-06-21 19:07 ` [PATCH 1/3] usb: dwc3: gadget: Fix TRB reclaim logic for short transfers and ZLPs Johannes Schneider
2025-06-23 22:41   ` Thinh Nguyen
2025-06-25  7:49   ` [PATCH v3] " SCHNEIDER Johannes
2025-06-28 15:18     ` Greg Kroah-Hartman
2025-06-28 15:19     ` Greg Kroah-Hartman
2025-06-21 19:07 ` [PATCH 2/3] usb: dwc3: gadget: Simplify TRB reclaim logic by removing redundant 'chain' argument Johannes Schneider
2025-06-23 22:43   ` Thinh Nguyen
2025-06-25  7:53     ` [PATCH v3] " SCHNEIDER Johannes
2025-06-28 15:23       ` Greg Kroah-Hartman
2025-06-29  8:45         ` SCHNEIDER Johannes
2025-06-29  9:06           ` Greg Kroah-Hartman [this message]
2025-06-21 19:07 ` [PATCH 3/3] usb: dwc3: gadget: Simplify logic in dwc3_needs_extra_trb() Johannes Schneider
2025-06-23 22:31   ` Thinh Nguyen
2025-06-24 10:47     ` SCHNEIDER Johannes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2025062945-expose-veteran-3c35@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=bsp-development.geo@leica-geosystems.com \
    --cc=johannes.schneider@leica-geosystems.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox