From 655efa0ff202484ac1ec43156b98373b53a77eb3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 28 Jan 2013 22:16:03 +0800 Subject: regulator: gpio-regulator: Use of_gpio_count() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/gpio-regulator.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/regulator') 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, -- cgit v1.2.3-59-g8ed1b From a451405fcdf4048aa46c80ede25b36eba27ba3ec Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 28 Jan 2013 22:17:46 +0800 Subject: regulator: gpio-regulator: Staticize of_get_gpio_regulator_config() of_get_gpio_regulator_config() is only used in gpio-regulator.c, make it static. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/gpio-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/regulator') diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index d819ba73a187..9d39eb4aafa3 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -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; -- cgit v1.2.3-59-g8ed1b From 896b65f3453d434983969e3ee7c254f4f8ba1424 Mon Sep 17 00:00:00 2001 From: Michał Mirosław Date: Fri, 1 Feb 2013 20:40:17 +0100 Subject: regulator: show state for GPIO-controlled regulators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Mirosław Signed-off-by: Mark Brown --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/regulator') diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 278584302f2d..6b3550ab480f 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3208,7 +3208,7 @@ static int add_regulator_attributes(struct regulator_dev *rdev) if (status < 0) return status; } - if (ops->is_enabled) { + if (rdev->ena_gpio || ops->is_enabled) { status = device_create_file(dev, &dev_attr_state); if (status < 0) return status; -- cgit v1.2.3-59-g8ed1b