From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>, u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
Lukasz Majewski <lukma@denx.de>, Nishanth Menon <nm@ti.com>,
Simon Glass <sjg@chromium.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Tom Rini <trini@konsulko.com>,
Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH 5/6] usb: gadget: Add full ep_matches() check past .match_ep() callback
Date: Tue, 11 Jun 2024 09:42:11 +0200 [thread overview]
Message-ID: <87y17cylgs.fsf@baylibre.com> (raw)
In-Reply-To: <20240609213449.194762-5-marek.vasut+renesas@mailbox.org>
Hi Marek,
Thank you for the patch.
On dim., juin 09, 2024 at 23:32, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> If .match_ep() callback returns non-NULL endpoint, immediately check
> its usability and if the returned endpoint is usable, stop search and
> return the endpoint. Otherwise, continue with best effort search for
> usable endpoint.
>
> Currently the code would attempt the best effort search in any case,
> which may find another unexpected endpoint. It is likely that the
> intention of the original code was to stop the search early.
>
> Fixes: 77dcbdf3c1ce ("usb: gadget: Add match_ep() op to usb_gadget_ops")
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
I've added Vignesh to the CC list since he is the author of
77dcbdf3c1ce. He might be able to comment if this was indeed a mistake.
It looks like a good fix to me as well. With this change we match more closely
the linux implementation (usb_ep_autoconfig_ss()).
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
> ---
> Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
> drivers/usb/gadget/epautoconf.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
> index 09950ceeaed..66599ce8efa 100644
> --- a/drivers/usb/gadget/epautoconf.c
> +++ b/drivers/usb/gadget/epautoconf.c
> @@ -247,8 +247,11 @@ struct usb_ep *usb_ep_autoconfig(
> return ep;
> }
>
> - if (gadget->ops->match_ep)
> + if (gadget->ops->match_ep) {
> ep = gadget->ops->match_ep(gadget, desc, NULL);
> + if (ep && ep_matches(gadget, ep, desc))
> + return ep;
> + }
>
> /* Second, look at endpoints until an unclaimed one looks usable */
> list_for_each_entry(ep, &gadget->ep_list, ep_list) {
> --
> 2.43.0
next prev parent reply other threads:[~2024-06-11 7:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 21:32 [PATCH 1/6] usb: gadget: g_dnl: Drop usb_gadget_controller_number() Marek Vasut
2024-06-09 21:32 ` [PATCH 2/6] usb: gadget: ether: " Marek Vasut
2024-06-11 7:16 ` Mattijs Korpershoek
2024-06-09 21:32 ` [PATCH 3/6] usb: gadget: " Marek Vasut
2024-06-11 7:20 ` Mattijs Korpershoek
2024-06-11 8:51 ` Lukasz Majewski
2024-06-11 9:20 ` Mattijs Korpershoek
2024-06-09 21:32 ` [PATCH 4/6] usb: gadget: Drop all gadget_is_*() functions Marek Vasut
2024-06-11 7:35 ` Mattijs Korpershoek
2024-06-09 21:32 ` [PATCH 5/6] usb: gadget: Add full ep_matches() check past .match_ep() callback Marek Vasut
2024-06-11 7:42 ` Mattijs Korpershoek [this message]
2024-06-09 21:32 ` [PATCH 6/6] usb: dwc3: gadget: Convert epautoconf workaround to match_ep callback Marek Vasut
2024-06-10 10:10 ` Sverdlin, Alexander
2024-06-11 7:56 ` Mattijs Korpershoek
2024-06-11 7:14 ` [PATCH 1/6] usb: gadget: g_dnl: Drop usb_gadget_controller_number() Mattijs Korpershoek
2024-07-05 12:02 ` Mattijs Korpershoek
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=87y17cylgs.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=alexander.sverdlin@siemens.com \
--cc=felipe.balbi@linux.intel.com \
--cc=lukma@denx.de \
--cc=marek.vasut+renesas@mailbox.org \
--cc=nm@ti.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vigneshr@ti.com \
/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