public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: gpio: Don't require a regulator-type property
@ 2013-12-05  0:31 Mark Brown
  2013-12-05  0:44 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2013-12-05  0:31 UTC (permalink / raw)
  To: Liam Girdwood, Laurent Pinchart; +Cc: linux-kernel, Mark Brown

From: Mark Brown <broonie@linaro.org>

Since essentially all GPIO controlled regulators are voltage regulators
make the regulator-type property optional, defaulting to voltage.

Signed-off-by: Mark Brown <broonie@linaro.org>
---

Compile tested only.

 drivers/regulator/gpio-regulator.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 234960dc9607..13ec94d984ca 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -203,17 +203,15 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
 	}
 	config->nr_states = i;
 
+	config->type = REGULATOR_VOLTAGE;
 	ret = of_property_read_string(np, "regulator-type", &regtype);
-	if (ret < 0) {
-		dev_err(dev, "Missing 'regulator-type' property\n");
-		return ERR_PTR(-EINVAL);
+	if (ret >= 0) {
+		if (!strncmp("voltage", regtype, 7))
+			config->type = REGULATOR_VOLTAGE;
+		else if (!strncmp("current", regtype, 7))
+			config->type = REGULATOR_CURRENT;
 	}
 
-	if (!strncmp("voltage", regtype, 7))
-		config->type = REGULATOR_VOLTAGE;
-	else if (!strncmp("current", regtype, 7))
-		config->type = REGULATOR_CURRENT;
-
 	return config;
 }
 
-- 
1.8.5.1


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

end of thread, other threads:[~2013-12-05 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-05  0:31 [PATCH] regulator: gpio: Don't require a regulator-type property Mark Brown
2013-12-05  0:44 ` Laurent Pinchart
2013-12-05 11:35   ` Mark Brown

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