Commit b2a1ef47 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Mark Brown

regulator: core: request only valid gpio pins for regulator enable

Commit 65f73508 ("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: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent e76ab829
...@@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
dev_set_drvdata(&rdev->dev, rdev); dev_set_drvdata(&rdev->dev, rdev);
if (config->ena_gpio) { if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) {
ret = gpio_request_one(config->ena_gpio, ret = gpio_request_one(config->ena_gpio,
GPIOF_DIR_OUT | config->ena_gpio_flags, GPIOF_DIR_OUT | config->ena_gpio_flags,
rdev_get_name(rdev)); rdev_get_name(rdev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment