From 5b1ada83bae7d689cf1fe76eb1bdd058ea84a97c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 5 Dec 2013 00:29:57 +0000 Subject: regulator: gpio: Don't require a regulator-type property Since essentially all GPIO controlled regulators are voltage regulators make the regulator-type property optional, defaulting to voltage. Signed-off-by: Mark Brown --- drivers/regulator/gpio-regulator.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers/regulator/gpio-regulator.c') diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index bcd827c363dc..cdb9d947d914 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; } -- cgit v1.2.3 From 9eb9d3150bd941be2f2e370e0081736d9d51e31b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 5 Dec 2013 19:09:55 +0000 Subject: regulator: gpio: Warn if an invalid regulator-type is supplied Reported-by: Laurent Pinchart Acked-by: Laurent Pinchart Signed-off-by: Mark Brown --- drivers/regulator/gpio-regulator.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/regulator/gpio-regulator.c') diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index cdb9d947d914..49fe20f58d2a 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -210,6 +210,9 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) config->type = REGULATOR_VOLTAGE; else if (!strncmp("current", regtype, 7)) config->type = REGULATOR_CURRENT; + else + dev_warn(dev, "Unknown regulator-type '%s'\n", + regtype); } return config; -- cgit v1.2.3