linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: don't require a supply when supply_name is specified
@ 2013-04-04 22:27 Andrew Bresticker
  2013-04-05  9:54 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Bresticker @ 2013-04-04 22:27 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, Doug Anderson, Andrew Bresticker

Regulator drivers may specify regulator_desc->supply_name which
regulator_register() will use to find the supply node for a regulator.
If no supply was specified in the device tree or the supply has yet
to be registered regulator_register() will fail, deferring the probe
of the regulator.  In the case where no supply node was specified in the
device tree, there is no supply and it is pointless to try and find one
later, so go ahead and add the regulator without the supply.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
---
 drivers/regulator/core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a95096e..6267f1c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3476,7 +3476,14 @@ regulator_register(const struct regulator_desc *regulator_desc,
 
 		r = regulator_dev_lookup(dev, supply, &ret);
 
-		if (!r) {
+		if (ret == -ENODEV) {
+			/*
+			 * No supply was specified for this regulator and
+			 * there will never be one.
+			 */
+			ret = 0;
+			goto add_dev;
+		} else if (!r) {
 			dev_err(dev, "Failed to find supply %s\n", supply);
 			ret = -EPROBE_DEFER;
 			goto scrub;
@@ -3494,6 +3501,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
 		}
 	}
 
+add_dev:
 	/* add consumers devices */
 	if (init_data) {
 		for (i = 0; i < init_data->num_consumer_supplies; i++) {
-- 
1.8.1.3


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

* Re: [PATCH] regulator: core: don't require a supply when supply_name is specified
  2013-04-04 22:27 [PATCH] regulator: core: don't require a supply when supply_name is specified Andrew Bresticker
@ 2013-04-05  9:54 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-04-05  9:54 UTC (permalink / raw)
  To: Andrew Bresticker; +Cc: Liam Girdwood, linux-kernel, Doug Anderson

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

On Thu, Apr 04, 2013 at 03:27:47PM -0700, Andrew Bresticker wrote:

> Regulator drivers may specify regulator_desc->supply_name which
> regulator_register() will use to find the supply node for a regulator.
> If no supply was specified in the device tree or the supply has yet
> to be registered regulator_register() will fail, deferring the probe
> of the regulator.  In the case where no supply node was specified in the
> device tree, there is no supply and it is pointless to try and find one
> later, so go ahead and add the regulator without the supply.

I'd call this a broken device tree to be honest, the regulators ought to
have a supply specified.  We should complain about it.  We probably
ought to be doing this though so I'll apply.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-04-05  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 22:27 [PATCH] regulator: core: don't require a supply when supply_name is specified Andrew Bresticker
2013-04-05  9:54 ` Mark Brown

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