Merge remote-tracking branch 'regulator/topic/gpio' into regulator-next
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Feb 2013 12:42:34 +0000 (12:42 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Feb 2013 12:42:34 +0000 (12:42 +0000)
drivers/regulator/core.c
drivers/regulator/gpio-regulator.c

index 98a6ec3240e49da3cd42ebe17764c57def7b6805..da9782bd27d0a182d32578c4779481072d0657ef 100644 (file)
@@ -3233,7 +3233,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;
index bae681ccd3ea73a24c0c0d3f98a948d9a7fd06f1..9d39eb4aafa3634762678dcf65d460d66b9de8a7 100644 (file)
@@ -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;
@@ -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,