public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] USB: gadget: save driver name before registering it
@ 2014-05-01 21:45 Stephen Warren
  2014-05-05  8:08 ` Lukasz Majewski
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2014-05-01 21:45 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

g_dnl_register() currently first attempts to register a composite
driver by name, and then saves the driver name once it's registered.
Internally to the registration code, g_dnl_do_config() is called and
attempts to compare the composite device's name with the list of known
device names. This fails since the composite device's name has not yet
been stored. This means that the first time "ums 0 0" is run, it fails,
but subsequent attempts succeed.

Re-order the name-saving and registration code to solve this.

Fixes: e5b834e07f51 ("USB: gadget: added a saner gadget downloader registration API")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This should likely be applied to u-boot-dfu/master along with Mateusz's
original patch, or folded into it.

 drivers/usb/gadget/g_dnl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 743bae535ac8..25611acd607f 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -245,11 +245,12 @@ static struct usb_composite_driver g_dnl_driver = {
  */
 int g_dnl_register(const char *name)
 {
-	int ret = usb_composite_register(&g_dnl_driver);
+	int ret;
 
 	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
 	g_dnl_driver.name = name;
 
+	ret = usb_composite_register(&g_dnl_driver);
 	if (ret) {
 		printf("%s: failed!, error: %d\n", __func__, ret);
 		return ret;
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] USB: gadget: save driver name before registering it
  2014-05-01 21:45 [U-Boot] [PATCH] USB: gadget: save driver name before registering it Stephen Warren
@ 2014-05-05  8:08 ` Lukasz Majewski
  0 siblings, 0 replies; 2+ messages in thread
From: Lukasz Majewski @ 2014-05-05  8:08 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

> From: Stephen Warren <swarren@nvidia.com>
> 
> g_dnl_register() currently first attempts to register a composite
> driver by name, and then saves the driver name once it's registered.
> Internally to the registration code, g_dnl_do_config() is called and
> attempts to compare the composite device's name with the list of known
> device names. This fails since the composite device's name has not yet
> been stored. This means that the first time "ums 0 0" is run, it
> fails, but subsequent attempts succeed.
> 
> Re-order the name-saving and registration code to solve this.
> 
> Fixes: e5b834e07f51 ("USB: gadget: added a saner gadget downloader
> registration API") Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot-dfu. Thanks.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-05  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-01 21:45 [U-Boot] [PATCH] USB: gadget: save driver name before registering it Stephen Warren
2014-05-05  8:08 ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox