public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: "Frank Li" <frank.li@nxp.com>,
	"r-gunasekaran@ti.com" <r-gunasekaran@ti.com>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"Jun Li" <jun.li@nxp.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Elson Roy Serrao" <quic_eserrao@quicinc.com>,
	"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Jó Ágila Bitsch" <jgilab@gmail.com>,
	"Prashanth K" <quic_prashk@quicinc.com>,
	"Peter Chen" <peter.chen@kernel.org>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [EXT] Re: [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability
Date: Fri, 30 Jun 2023 22:43:14 +0300	[thread overview]
Message-ID: <158f9975-afff-25b8-130c-2a8381ce21ee@kernel.org> (raw)
In-Reply-To: <AM6PR04MB4838E7A9B41AB382DAAA35038825A@AM6PR04MB4838.eurprd04.prod.outlook.com>



On 29/06/2023 06:40, Frank Li wrote:
> 
> 
>> -----Original Message-----
>> From: Roger Quadros <rogerq@kernel.org>
>> Sent: Wednesday, June 28, 2023 10:23 PM
>> To: Frank Li <frank.li@nxp.com>; r-gunasekaran@ti.com; imx@lists.linux.dev;
>> Jun Li <jun.li@nxp.com>; Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org>; Elson Roy Serrao
>> <quic_eserrao@quicinc.com>; Thinh Nguyen
>> <Thinh.Nguyen@synopsys.com>; Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com>; Jó Ágila Bitsch <jgilab@gmail.com>;
>> Prashanth K <quic_prashk@quicinc.com>; Peter Chen
>> <peter.chen@kernel.org>; open list:USB SUBSYSTEM <linux-
>> usb@vger.kernel.org>; open list <linux-kernel@vger.kernel.org>
>> Subject: [EXT] Re: [PATCH 1/1] usb: gadget: call usb_gadget_check_config()
>> to verify UDC capability
>>
>> Caution: This is an external email. Please take care when clicking links or
>> opening attachments. When in doubt, report the message using the 'Report
>> this email' button
>>
>>
>> On 29/06/2023 03:54, Frank Li wrote:
>>> The legacy gadget driver omitted calling usb_gadget_check_config()
>>> to ensure that the USB device controller (UDC) has adequate resources,
>>> including sufficient endpoint numbers and types, to support the given
>>> configuration.
>>>
>>> Previously, usb_add_config() was solely invoked by the legacy gadget
>>> driver. Adds the necessary usb_gadget_check_config() after the bind()
>>> operation to fix the issue.
>>
>> You have only fixed composite.c. Not all gadget drivers use composite.c
>> so it will be still broken for them.
>>
>> Please also add default sane configuration in CDNS3 so it works even
>> if usb_gadget_check_config() is not invoked.
> 
> Which one was not call usb_add_config()?
> DWC3 also use
>  .check_config		= dwc3_gadget_check_config, 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc3/gadget.c 

I meant gadget drivers not UDC drivers.

e.g.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/gadget/legacy/dbgp.c

> 
> I think it is not correct by assume UDC can support specific config
> at gadget function driver. 
> Add default value of CDNS3 actually hidden potential problem. 
> 
> I don't suggest it before fixed hidden potential problem. 
> 
> Frank  
> 
>>
>>>
>>> Fixes: dce49449e04f ("usb: cdns3: allocate TX FIFO size according to
>> composite EP number")
>>> Reported-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
>>> Signed-off-by: Frank Li <Frank.Li@nxp.com>
>>> ---
>>>  drivers/usb/gadget/composite.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/usb/gadget/composite.c
>> b/drivers/usb/gadget/composite.c
>>> index 1b3489149e5e..dd9b90481b4c 100644
>>> --- a/drivers/usb/gadget/composite.c
>>> +++ b/drivers/usb/gadget/composite.c
>>> @@ -1125,6 +1125,10 @@ int usb_add_config(struct usb_composite_dev
>> *cdev,
>>>               goto done;
>>>
>>>       status = bind(config);
>>> +
>>> +     if (status == 0)
>>> +             status = usb_gadget_check_config(cdev->gadget);
>>> +
>>>       if (status < 0) {
>>>               while (!list_empty(&config->functions)) {
>>>                       struct usb_function             *f;
>>
>> --
>> cheers,
>> -roger

-- 
cheers,
-roger

  reply	other threads:[~2023-06-30 19:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 22:24 [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability Frank Li
2023-06-29  3:23 ` Roger Quadros
2023-06-29  3:40   ` [EXT] " Frank Li
2023-06-30 19:43     ` Roger Quadros [this message]
2023-06-30 19:57       ` Frank Li
2023-06-29  5:11 ` Ravi Gunasekaran
2023-06-29 14:48   ` [EXT] " Frank Li

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=158f9975-afff-25b8-130c-2a8381ce21ee@kernel.org \
    --to=rogerq@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=frank.li@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jgilab@gmail.com \
    --cc=jun.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@kernel.org \
    --cc=quic_eserrao@quicinc.com \
    --cc=quic_prashk@quicinc.com \
    --cc=r-gunasekaran@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