From: Axel Lin Date: Mon, 28 Jan 2013 14:16:03 +0000 (+0800) Subject: regulator: gpio-regulator: Use of_gpio_count() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=655efa0ff202484ac1ec43156b98373b53a77eb3;p=linux-beck.git regulator: gpio-regulator: Use of_gpio_count() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index bae681ccd3ea..d819ba73a187 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -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,