diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-19 07:42:34 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-19 07:42:34 -0500 |
commit | a4dba88e6311ac51ea4328fea6fd000dc2948ddb (patch) | |
tree | c6ee3f7d44a504e16679fc19eeb481f164f76177 | |
parent | eb230d4a6120673938dddd1e4fbbf3ff6def2976 (diff) | |
parent | 896b65f3453d434983969e3ee7c254f4f8ba1424 (diff) |
Merge remote-tracking branch 'regulator/topic/gpio' into regulator-next
-rw-r--r-- | drivers/regulator/core.c | 2 | ||||
-rw-r--r-- | drivers/regulator/gpio-regulator.c | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 98a6ec3240e4..da9782bd27d0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3233,7 +3233,7 @@ static int add_regulator_attributes(struct regulator_dev *rdev) | |||
3233 | if (status < 0) | 3233 | if (status < 0) |
3234 | return status; | 3234 | return status; |
3235 | } | 3235 | } |
3236 | if (ops->is_enabled) { | 3236 | if (rdev->ena_gpio || ops->is_enabled) { |
3237 | status = device_create_file(dev, &dev_attr_state); | 3237 | status = device_create_file(dev, &dev_attr_state); |
3238 | if (status < 0) | 3238 | if (status < 0) |
3239 | return status; | 3239 | return status; |
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index bae681ccd3ea..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 = { | |||
132 | .list_voltage = gpio_regulator_list_voltage, | 132 | .list_voltage = gpio_regulator_list_voltage, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | struct gpio_regulator_config * | 135 | static struct gpio_regulator_config * |
136 | of_get_gpio_regulator_config(struct device *dev, struct device_node *np) | 136 | of_get_gpio_regulator_config(struct device *dev, struct device_node *np) |
137 | { | 137 | { |
138 | struct gpio_regulator_config *config; | 138 | struct gpio_regulator_config *config; |
@@ -163,10 +163,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) | |||
163 | config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0); | 163 | config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0); |
164 | 164 | ||
165 | /* Fetch GPIOs. */ | 165 | /* Fetch GPIOs. */ |
166 | for (i = 0; ; i++) | 166 | config->nr_gpios = of_gpio_count(np); |
167 | if (of_get_named_gpio(np, "gpios", i) < 0) | ||
168 | break; | ||
169 | config->nr_gpios = i; | ||
170 | 167 | ||
171 | config->gpios = devm_kzalloc(dev, | 168 | config->gpios = devm_kzalloc(dev, |
172 | sizeof(struct gpio) * config->nr_gpios, | 169 | sizeof(struct gpio) * config->nr_gpios, |