* [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", ®type);
- 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
* Re: [PATCH] regulator: gpio: Don't require a regulator-type property
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
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2013-12-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, Laurent Pinchart, linux-kernel, Mark Brown
Hi Mark,
Thanks for the patch.
On Thursday 05 December 2013 00:31:55 Mark Brown wrote:
> 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", ®type);
> - 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;
Should we warn or error in case of an unsupported value ?
> }
>
> - if (!strncmp("voltage", regtype, 7))
> - config->type = REGULATOR_VOLTAGE;
> - else if (!strncmp("current", regtype, 7))
> - config->type = REGULATOR_CURRENT;
> -
> return config;
> }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: gpio: Don't require a regulator-type property
2013-12-05 0:44 ` Laurent Pinchart
@ 2013-12-05 11:35 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-12-05 11:35 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: Liam Girdwood, Laurent Pinchart, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
On Thu, Dec 05, 2013 at 01:44:42AM +0100, Laurent Pinchart wrote:
> On Thursday 05 December 2013 00:31:55 Mark Brown wrote:
> > + if (ret >= 0) {
> > + if (!strncmp("voltage", regtype, 7))
> > + config->type = REGULATOR_VOLTAGE;
> > + else if (!strncmp("current", regtype, 7))
> > + config->type = REGULATOR_CURRENT;
> Should we warn or error in case of an unsupported value ?
That's sensible, yes - this was just a straight change to make the
property optional. Given that we've always accepted anything a warning
seems more appropriate otherwise we might break existing DTs with typos
or something.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [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