diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-08-09 10:33:00 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-09 14:52:21 -0400 |
commit | b2a1ef473b031b630a26685c91a46b9ae668d35c (patch) | |
tree | d1d6b441c4382c679deaf2fa66fd054aba78e190 | |
parent | e76ab829cc2d8b6350a3f01fffb208df4d7d8c1b (diff) |
regulator: core: request only valid gpio pins for regulator enable
Commit 65f735082de3 ("regulator: core: Add core support for GPIO controlled
enable lines") introduced enable gpio entry in regulator configuration
structure. Some drivers use '-1' as a placeholder for marking that such
gpio line is not available, because '0' is considered as a valid gpio
number. This patch fixes initialization of such drivers (like MAX8952
on UniversalC210 board), when '-1' is provided as enable gpio pin in the
regulator's platform data.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/regulator/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f092588a078c..48385318175a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
3217 | 3217 | ||
3218 | dev_set_drvdata(&rdev->dev, rdev); | 3218 | dev_set_drvdata(&rdev->dev, rdev); |
3219 | 3219 | ||
3220 | if (config->ena_gpio) { | 3220 | if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) { |
3221 | ret = gpio_request_one(config->ena_gpio, | 3221 | ret = gpio_request_one(config->ena_gpio, |
3222 | GPIOF_DIR_OUT | config->ena_gpio_flags, | 3222 | GPIOF_DIR_OUT | config->ena_gpio_flags, |
3223 | rdev_get_name(rdev)); | 3223 | rdev_get_name(rdev)); |