Skip to content

Commit

Permalink
regulator: core: request only valid gpio pins for regulator enable
Browse files Browse the repository at this point in the history
Commit 65f7350 ("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>
  • Loading branch information
Marek Szyprowski authored and Mark Brown committed Aug 9, 2012
1 parent e76ab82 commit b2a1ef4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc,

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,
GPIOF_DIR_OUT | config->ena_gpio_flags,
rdev_get_name(rdev));
Expand Down

0 comments on commit b2a1ef4

Please sign in to comment.