usb: gadget: composite: Correct recovery path for register
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
From: Sam Protsenko <[email protected]>
In case when usb_composite_register() failed once (for whatever reason), it will fail further even if all conditions are correct. Example:
=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.
=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.
Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/gadget/composite.c +7 -1
@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver composite_driver = {*/ int usb_composite_register (struct usb_composite_driver *driver) { +int res; +if (!driver || !driver->dev || !driver->bind || composite)return -EINVAL ;
@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name ="composite" ; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }/**
Signature · 1 line
2.7.0
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
+ Praneeth Bajjuri
+ Tom Rini
+ Rob Herring
Quoted 56 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/usb/gadget/composite.c +7
-2@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver composite_driver = {*/ int usb_composite_register (struct usb_composite_driver *driver) { +int res; +if (!driver || !driver->dev || !driver->bind || composite)return -EINVAL ;@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name ="composite" ; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }/** -- 2.7.0
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
Quoted 58 lines · Sam Protsenko
+ Praneeth Bajjuri
+ Tom Rini
+ Rob HerringQuoted 52 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/usb/gadget/composite.c +7
-1@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver composite_driver = {*/ int usb_composite_register (struct usb_composite_driver *driver) { +int res; +if (!driver || !driver->dev || !driver->bind || composite)return -EINVAL ;@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name ="composite" ; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }
Quoted 4 lines
Quoted 4 lines
drivers/usb/gadget/composite.c +0
-1/** -- 2.7.0
bump
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
Quoted 60 lines · Sam Protsenko
Quoted 58 lines · Sam Protsenko
+ Praneeth Bajjuri
+ Tom Rini
+ Rob HerringQuoted 52 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/usb/gadget/composite.c +7
-1@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver composite_driver = {*/ int usb_composite_register (struct usb_composite_driver *driver) { +int res; +if (!driver || !driver->dev || !driver->bind || composite)return -EINVAL ;@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name ="composite" ; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
drivers/usb/gadget/composite.c +0
-1/** -- 2.7.0
bump
Looks fine. Lukasz, shall I pick this myself ?
btw if this isn't applied in a week, please ping me and I will pick it nonetheless.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
Hi Marek,
Quoted 70 lines · Sam Protsenko
Quoted 61 lines
Quoted 59 lines · Sam Protsenko
+ Praneeth Bajjuri
+ Tom Rini
+ Rob HerringQuoted 53 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/usb/gadget/composite.cindex 60f9272..d0ee784 100644drivers/usb/gadget/composite.c +0
-0@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver
composite_driver= { */
intusb_composite_register(struct usb_composite_driver *driver){drivers/usb/gadget/composite.c +7
-1+int res; +if (!driver || !driver->dev || !driver->bind || composite)return -EINVAL ;@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name = "composite"; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
drivers/usb/gadget/composite.c +0
-1/** -- 2.7.0
bump
Quoted 5 lines
Looks fine. Lukasz, shall I pick this myself ?
btw if this isn't applied in a week, please ping me and I will pick it nonetheless.
I will add this to my tree. And test it afterwards.
I will send new PR with some other patches.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
Quoted 74 lines · Lukasz Majewski
Hi Marek,
Quoted 72 lines · Sam Protsenko
Quoted 61 lines
Quoted 59 lines · Sam Protsenko
+ Praneeth Bajjuri
+ Tom Rini
+ Rob HerringQuoted 53 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/usb/gadget/composite.cindex 60f9272..d0ee784 100644drivers/usb/gadget/composite.c +0
-0@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver
composite_driver= { */
intusb_composite_register(struct usb_composite_driver *driver){drivers/usb/gadget/composite.c +7
-1+int res; +if (!driver || !driver->dev || !driver->bind || composite)return -EINVAL ;@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name = "composite"; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
drivers/usb/gadget/composite.c +0
-1/** -- 2.7.0
bump
Looks fine. Lukasz, shall I pick this myself ?
Quoted 8 lines
Quoted 3 lines
btw if this isn't applied in a week, please ping me and I will pick it nonetheless.
I will add this to my tree. And test it afterwards.
I will send new PR with some other patches.
Roger, thanks!
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 usb: gadget: composite: Correct recovery path for register
Hi Marek,
Quoted 73 lines · Lukasz Majewski
Quoted 72 lines
Hi Marek,
Quoted 70 lines · Sam Protsenko
Quoted 68 lines
Quoted 59 lines · Sam Protsenko
+ Praneeth Bajjuri
+ Tom Rini
+ Rob HerringQuoted 53 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/usb/gadget/composite.cindex 60f9272..d0ee784 100644drivers/usb/gadget/composite.c +0
-0@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver
composite_driver= { */
intusb_composite_register(struct usb_composite_driver *driver){drivers/usb/gadget/composite.c +2
-0+int res; + if (!driver || !driver->dev || !driver->bind ||composite) return
-EINVAL;drivers/usb/gadget/composite.c +5
-1@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name = "composite"; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }Quoted 4 lines
Quoted 4 lines
drivers/usb/gadget/composite.c +0
-1/** -- 2.7.0
bump
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Looks fine. Lukasz, shall I pick this myself ?
btw if this isn't applied in a week, please ping me and I will pick it nonetheless.
I will add this to my tree. And test it afterwards.
This patch seems correct - no regression found.
Quoted 2 lines
Quoted 2 lines
I will send new PR with some other patches.
Patches which I thought that you didn't pull are already in u-boot-usb tree, so there is no point to prepare PR for this single patch.
Hence, Marek, please apply it directly to -usb tree.
Quoted 4 lines
Quoted 1 line
Roger, thanks!
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Marek Vasut
AppliedPATCH 1/1 usb: gadget: composite: Correct recovery path for register
Quoted 89 lines · Lukasz Majewski
Hi Marek,
Quoted 73 lines · Lukasz Majewski
Quoted 72 lines
Hi Marek,
Quoted 70 lines · Sam Protsenko
Quoted 68 lines
Quoted 59 lines · Sam Protsenko
+ Praneeth Bajjuri
+ Tom Rini
+ Rob HerringQuoted 53 lines · Semen Protsenko
From: Sam Protsenko <[email protected]>
In case when
usb_composite_register()failed once (for whatever reason), it will fail further even if all conditions are correct. Example:=> fastboot 2
Invalid Controller Index
couldn't find an available UDC
g_dnl_register: failed!, error: -19
exit not allowed from main input shell.=> fastboot 0
g_dnl_register: failed!, error: -22
exit not allowed from main input shell.Despite that 0 is correct index for USB controller, "fastboot 0" command will fail, because "composite" structure wasn't cleared properly on previous fail (on "fastboot 2" command).
This patch fixes that erroneous behavior, allowing us to use composite even after previous failure.
Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/usb/gadget/composite.cindex 60f9272..d0ee784 100644drivers/usb/gadget/composite.c +0
-0@@ -1077,6 +1077,8 @@ static struct usb_gadget_driver
composite_driver= { */
intusb_composite_register(struct usb_composite_driver *driver){drivers/usb/gadget/composite.c +2
-0+int res; + if (!driver || !driver->dev || !driver->bind ||composite) return
-EINVAL;drivers/usb/gadget/composite.c +5
-1@@ -1084,7 +1086,11 @@ int usb_composite_register(struct usb_composite_driver *driver) driver->name = "composite"; composite = driver; -return usb_gadget_register_driver (&composite_driver); + res =usb_gadget_register_driver (&composite_driver); +if (res !=0 ) + composite =NULL ; + +return res; }Quoted 4 lines
Quoted 4 lines
drivers/usb/gadget/composite.c +0
-1/** -- 2.7.0
bump
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Looks fine. Lukasz, shall I pick this myself ?
btw if this isn't applied in a week, please ping me and I will pick it nonetheless.
I will add this to my tree. And test it afterwards.
This patch seems correct - no regression found.
Tested-by Lukasz Majewski "<[email protected]>"Quoted 1 line
Quoted 1 line
Quoted 6 lines
Quoted 1 line
Quoted 1 line
I will send new PR with some other patches.
Patches which I thought that you didn't pull are already in u-boot-usb tree, so there is no point to prepare PR for this single patch.
Hence, Marek, please apply it directly to -usb tree.
Applied, thanks!
Signature · 2 lines
Best regards, Marek Vasut