linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: drd: Don't check against CONFIG_OF
@ 2022-02-15 22:49 Thinh Nguyen
  2022-02-17 13:50 ` (EXT) " Alexander Stein
  0 siblings, 1 reply; 2+ messages in thread
From: Thinh Nguyen @ 2022-02-15 22:49 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, linux-usb, Alexander Stein
  Cc: John Youn, Thinh Nguyen

The CONFIG_OF maybe set, but it may not be applicable to a device. In
such case, checking against that can cause the device fail to
initialize. Check against the device node (device->of_node) instead.

Fixes: a102f07e4edf ("usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch")
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Note: This patch should go on Greg's "usb-testing" branch as the commit it
fixes is not in mainline yet.

 drivers/usb/dwc3/drd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index 25f322e62d3f..b60b5f7b6dff 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -560,7 +560,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
 	if (IS_ERR(dwc->role_sw))
 		return PTR_ERR(dwc->role_sw);
 
-	if (IS_ENABLED(CONFIG_OF)) {
+	if (dwc->dev->of_node) {
 		/* populate connector entry */
 		int ret = devm_of_platform_populate(dwc->dev);
 

base-commit: 9902951f536c00b7f20c26fd98baa5432bb3c731
-- 
2.28.0


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

* Re: (EXT) [PATCH] usb: dwc3: drd: Don't check against CONFIG_OF
  2022-02-15 22:49 [PATCH] usb: dwc3: drd: Don't check against CONFIG_OF Thinh Nguyen
@ 2022-02-17 13:50 ` Alexander Stein
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Stein @ 2022-02-17 13:50 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, John Youn, Thinh Nguyen

Hi Thinh,

Am Dienstag, 15. Februar 2022, 23:49:48 CET schrieb Thinh Nguyen:
> The CONFIG_OF maybe set, but it may not be applicable to a device. In
> such case, checking against that can cause the device fail to
> initialize. Check against the device node (device->of_node) instead.
> 
> Fixes: a102f07e4edf ("usb: dwc3: drd: Add support for usb-conn-gpio based
> usb-role-switch") Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> Note: This patch should go on Greg's "usb-testing" branch as the commit it
> fixes is not in mainline yet.
> 
>  drivers/usb/dwc3/drd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
> index 25f322e62d3f..b60b5f7b6dff 100644
> --- a/drivers/usb/dwc3/drd.c
> +++ b/drivers/usb/dwc3/drd.c
> @@ -560,7 +560,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
>  	if (IS_ERR(dwc->role_sw))
>  		return PTR_ERR(dwc->role_sw);
> 
> -	if (IS_ENABLED(CONFIG_OF)) {
> +	if (dwc->dev->of_node) {
>  		/* populate connector entry */
>  		int ret = devm_of_platform_populate(dwc->dev);
> 
> 

Looks reasonable, thanks.

Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
on TQMa8MPxL using DT.

Regards,
Alexander




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

end of thread, other threads:[~2022-02-17 13:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 22:49 [PATCH] usb: dwc3: drd: Don't check against CONFIG_OF Thinh Nguyen
2022-02-17 13:50 ` (EXT) " Alexander Stein

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).