regulator: gpio-regulator: Use of_gpio_count()
authorAxel Lin <axel.lin@ingics.com>
Mon, 28 Jan 2013 14:16:03 +0000 (22:16 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 28 Jan 2013 16:44:17 +0000 (00:44 +0800)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/gpio-regulator.c

index bae681ccd3ea73a24c0c0d3f98a948d9a7fd06f1..d819ba73a1878651d9aa1683b86560058e7d993c 100644 (file)
@@ -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,