linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Elson Roy Serrao <quic_eserrao@quicinc.com>
Cc: Thinh.Nguyen@synopsys.com, balbi@kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	quic_wcheng@quicinc.com, quic_jackp@quicinc.com
Subject: Re: [PATCH] usb: gadget: Do not handle OS Descriptors config separately
Date: Thu, 16 Feb 2023 12:40:12 +0100	[thread overview]
Message-ID: <Y+4WHGNdWTZ5Hc6Y@kroah.com> (raw)
In-Reply-To: <1676331925-4771-1-git-send-email-quic_eserrao@quicinc.com>

On Mon, Feb 13, 2023 at 03:45:25PM -0800, Elson Roy Serrao wrote:
> Consider a multi-configuration composition in which the last
> configuration uses OS descriptors. Since this configuration will
> be sent first, the host may choose this config if it matches the
> choosing criteria and ignore the user configured order of the
> multi-config composition.

That is up to the host, so why is this an issue?

> Moreover linux based hosts do not re-order
> the received configurations based on their indices but process them
> in FIFO order.

s/linux/Linux/

> This may result in the host never choosing the user
> desired configuration because of the re-order caused by sending the
> OS descriptor config first. To avoid this, follow the user configured
> order and do not handle OS descriptor config separately.

I do not understand, what reordering is happening, and by whom?

> 
> Signed-off-by: Elson Roy Serrao <quic_eserrao@quicinc.com>

What commit does this fix?

> ---
>  drivers/usb/gadget/composite.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index fa7dd6c..685003a 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -589,18 +589,9 @@ static int config_desc(struct usb_composite_dev *cdev, unsigned w_value)
>  	w_value &= 0xff;
>  
>  	pos = &cdev->configs;
> -	c = cdev->os_desc_config;
> -	if (c)
> -		goto check_config;
> -
>  	while ((pos = pos->next) !=  &cdev->configs) {
>  		c = list_entry(pos, typeof(*c), list);
>  
> -		/* skip OS Descriptors config which is handled separately */
> -		if (c == cdev->os_desc_config)
> -			continue;
> -
> -check_config:

This feels wrong, are you sure that this code isn't here for a reason?
How did you test this?

thanks,

greg k-h

      reply	other threads:[~2023-02-16 11:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 23:45 [PATCH] usb: gadget: Do not handle OS Descriptors config separately Elson Roy Serrao
2023-02-16 11:40 ` Greg KH [this message]

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=Y+4WHGNdWTZ5Hc6Y@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_eserrao@quicinc.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_wcheng@quicinc.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;
as well as URLs for NNTP newsgroup(s).