Skip to contentSkip to conversation

regulator: gpio-regulator: Use of_gpio_count()

PATCH Applied Axel Lin 2 participants 3 messages Jan 28, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: gpio-regulator: Use of_gpio_count()

---
 drivers/regulator/gpio-regulator.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/regulator/gpio-regulator.c +1 -4
index bae681c..d819ba7 100644
@@ -163,10 +163,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
 	config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
 
 	/* Fetch GPIOs. */
-	for (i = 0; ; i++)
-		if (of_get_named_gpio(np, "gpios", i) < 0)
-			break;
-	config->nr_gpios = i;
+	config->nr_gpios = of_gpio_count(np);
 
 	config->gpios = devm_kzalloc(dev,
 				sizeof(struct gpio) * config->nr_gpios,
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 regulator: gpio-regulator: Staticize of_get_gpio_regulator_config()

of_get_gpio_regulator_config() is only used in gpio-regulator.c, make it static.

---
 drivers/regulator/gpio-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/gpio-regulator.c +1 -1
index d819ba7..9d39eb4 100644
@@ -132,7 +132,7 @@ static struct regulator_ops gpio_regulator_voltage_ops = {
 	.list_voltage = gpio_regulator_list_voltage,
 };
 
-struct gpio_regulator_config *
+static struct gpio_regulator_config *
 of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
 {
 	struct gpio_regulator_config *config;
Signature · 1 line
1.7.9.5