All of lore.kernel.org
 help / color / mirror / Atom feed
From: peng.fan at nxp.com <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [PATCH V2 09/17] usb: gadget: set correct usb_configuration for os_desc_config
Date: Mon, 25 Jan 2021 21:43:52 +0800	[thread overview]
Message-ID: <20210125134400.780-10-peng.fan@nxp.com> (raw)
In-Reply-To: <20210125134400.780-1-peng.fan@nxp.com>

From: Jun Li <jun.li@nxp.com>

The current way to set cdev->os_desc_config is wrong if user restart
fastboot, as the old config is not used anymore and new allocated
usb_configuration will be used, so set the os_desc_config while
usb_add_config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/usb/gadget/composite.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index cd61bfec38..e6fdefd3d0 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -399,10 +399,6 @@ static int set_config(struct usb_composite_dev *cdev,
 		goto done;
 
 	cdev->config = c;
-	if (cdev->use_os_string) {
-		cdev->os_desc_config = c;
-		os_desc_config = c;
-	}
 
 	/* Initialize all interfaces by setting them to altsetting zero. */
 	for (tmp = 0; tmp < MAX_CONFIG_INTERFACES; tmp++) {
@@ -516,6 +512,9 @@ int usb_add_config(struct usb_composite_dev *cdev,
 
 	usb_ep_autoconfig_reset(cdev->gadget);
 
+	if (os_desc_config)
+		cdev->os_desc_config = os_desc_config;
+
 done:
 	if (status)
 		debug("added config '%s'/%u --> %d\n", config->label,
@@ -1373,9 +1372,6 @@ static int composite_bind(struct usb_gadget *gadget)
 		/* Microsoft OS String Descriptor */
 		utf8_to_utf16le(qw_sign_buf, (__le16 *)cdev->qw_sign,
 				OS_STRING_QW_SIGN_LEN / 2);
-
-		if (os_desc_config)
-			cdev->os_desc_config = os_desc_config;
 	}
 
 	debug("%s: ready\n", composite->name);
-- 
2.28.0

  parent reply	other threads:[~2021-01-25 13:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 13:43 [PATCH V2 00/17] usb: gadget: update peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 01/17] usb: gadget: Add ep_config call back to usb_gadget_ops peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 02/17] usb: gadget: don't change ep name for dwc3 while ep autoconfig peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 03/17] usb: gadget: OS String support peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 04/17] usb: gadget: move utf8_to_utf16le to header file peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 05/17] usb: gadget: add Kconfig for OS descriptors peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 06/17] usb: gadget: OS Feature Descriptors support peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 07/17] usb: gadget: add WCID support for mfgtool peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 08/17] usb: gadget: fastboot: add ext properties for WCID peng.fan at nxp.com
2021-01-25 13:43 ` peng.fan at nxp.com [this message]
2021-01-25 13:43 ` [PATCH V2 10/17] usb: gadget: update os_desc_config when add config peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 11/17] usb: gadget: add super speed support peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 12/17] usb: fastboot: " peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 13/17] usb: gadget: dnl: set dnl to be super speed peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 14/17] usb: composite: force gadget to be USB2 for HS only function peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 15/17] usb: udc: ci: update speed handling peng.fan at nxp.com
2021-01-25 13:43 ` [PATCH V2 16/17] usb: gadget: fastboot: use correct max packet size peng.fan at nxp.com
2021-06-23 10:15   ` Maxime Ripard
2021-01-25 13:44 ` [PATCH V2 17/17] usb: gaget: ci: set ep's desc when enable ep peng.fan at nxp.com

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=20210125134400.780-10-peng.fan@nxp.com \
    --to=peng.fan@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.