mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb: i.MX: warn if vbus regulator isn't available
@ 2020-10-27 17:40 Uwe Kleine-König
  2020-10-27 17:57 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2020-10-27 17:40 UTC (permalink / raw)
  To: barebox; +Cc: Marco Felsch

Instead of just ignoring errors related to regulator yield at least a
warning message.

In case there is no regulator in the device tree, regulator_get() returns
the dummy regulator and not an error code. The alternative to error out
wasn't accepted because this probably creates regressions for regulators
that are default-on but without a driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/usb/imx/chipidea-imx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 786beede6d89..ad3eb9aa35aa 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -267,8 +267,11 @@ static int imx_chipidea_probe(struct device_d *dev)
 	}
 
 	ci->vbus = regulator_get(dev, "vbus");
-	if (IS_ERR(ci->vbus))
+	if (IS_ERR(ci->vbus)) {
+		ret = ERR_PTR(ci->vbus);
+		dev_warn(dev, "Cannot get vbus regulator: %s (ignoring)\n", strerror(-ret));
 		ci->vbus = NULL;
+	}
 
 	/*
 	 * Some devices have more than one clock, in this case they are enabled
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] usb: i.MX: warn if vbus regulator isn't available
  2020-10-27 17:40 [PATCH] usb: i.MX: warn if vbus regulator isn't available Uwe Kleine-König
@ 2020-10-27 17:57 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2020-10-27 17:57 UTC (permalink / raw)
  To: Uwe Kleine-König, barebox; +Cc: Marco Felsch

Hello Uwe,

On 10/27/20 6:40 PM, Uwe Kleine-König wrote:
> Instead of just ignoring errors related to regulator yield at least a
> warning message.
> 
> In case there is no regulator in the device tree, regulator_get() returns
> the dummy regulator and not an error code. The alternative to error out
> wasn't accepted because this probably creates regressions for regulators
> that are default-on but without a driver.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/usb/imx/chipidea-imx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
> index 786beede6d89..ad3eb9aa35aa 100644
> --- a/drivers/usb/imx/chipidea-imx.c
> +++ b/drivers/usb/imx/chipidea-imx.c
> @@ -267,8 +267,11 @@ static int imx_chipidea_probe(struct device_d *dev)
>  	}
>  
>  	ci->vbus = regulator_get(dev, "vbus");
> -	if (IS_ERR(ci->vbus))
> +	if (IS_ERR(ci->vbus)) {
> +		ret = ERR_PTR(ci->vbus);
> +		dev_warn(dev, "Cannot get vbus regulator: %s (ignoring)\n", strerror(-ret));

We have %pe now in barebox that you can use instead.

>  		ci->vbus = NULL;
> +	}
>  
>  	/*
>  	 * Some devices have more than one clock, in this case they are enabled
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-10-27 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 17:40 [PATCH] usb: i.MX: warn if vbus regulator isn't available Uwe Kleine-König
2020-10-27 17:57 ` Ahmad Fatoum

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