USB: gadget: save driver name before registering it
PATCH 1/1 USB: gadget: save driver name before registering it
From: Stephen Warren <[email protected]>
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.
---
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(-)
drivers/usb/gadget/g_dnl.c +2 -1
@@ -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;
Signature · 1 line
1.8.1.5
PATCH 1/1 USB: gadget: save driver name before registering it
Hi Stephen,
Quoted 10 lines
From: Stephen Warren <[email protected]>
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.
Quoted 4 lines
Re-order the name-saving and registration code to solve this.
Fixes e5b834e07f51 ("USB: gadget: added a saner gadget downloaderregistration API") Signed-off-by: Stephen Warren <[email protected]>
Applied to u-boot-dfu. Thanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group