mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Marco Felsch <m.felsch@pengutronix.de>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2] usb: i.MX: warn if vbus regulator isn't available
Date: Fri,  5 Mar 2021 10:00:01 +0100	[thread overview]
Message-ID: <20210305090001.3619780-1-u.kleine-koenig@pengutronix.de> (raw)

Instead of just ignoring errors related to getting the vbus regulator
yield at least a warning message. This would have saved me some
debugging time when trying to understand why USB doesn't work without
the right regulator driver enabled.

Note that machines that don't define a regulator in their device tree
don't issue this warning as regulator_get() returns the dummy regulator
in this case.

The alternative to error out wasn't accepted because this probably
creates regressions for regulators that are default-on but without a
driver in barebox.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

(implicit) v1 was sent some time ago with Message-ID:
<1485d35a-d55b-2440-4852-1737e78f8aa1@pengutronix.de>. Ahmad suggested
to use %pe instead of strerror(-ret). This is also the only change
compared to the first submission.

Best regards
Uwe

 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 7b87f302a921..aa27941c8c66 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -256,8 +256,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)) {
+		dev_warn(dev, "Cannot get vbus regulator: %pe (ignoring)\n",
+			 ci->vbus);
 		ci->vbus = NULL;
+	}
 
 	/*
 	 * Some devices have more than one clock, in this case they are enabled
-- 
2.30.0


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

             reply	other threads:[~2021-03-05  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05  9:00 Uwe Kleine-König [this message]
2021-05-22 14:22 ` Uwe Kleine-König
2021-05-25  5:24 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305090001.3619780-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    --subject='Re: [PATCH v2] usb: i.MX: warn if vbus regulator isn'\''t available' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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