Commit e8a33aa0 authored by Linus Walleij's avatar Linus Walleij Committed by Mark Brown

regulator: lm363x: Let core handle GPIO descriptor

Use the gpiod_get() rather than the devm_* version so that the
regulator core can handle the lifecycle of these descriptors.

Fixes: b2d751b7 ("regulator: lm363x: Pass descriptor instead of GPIO number")
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5e6f3ae5
...@@ -224,13 +224,15 @@ static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev, ...@@ -224,13 +224,15 @@ static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev,
/* /*
* Check LCM_EN1/2_GPIO is configured. * Check LCM_EN1/2_GPIO is configured.
* Those pins are used for enabling VPOS/VNEG LDOs. * Those pins are used for enabling VPOS/VNEG LDOs.
* Do not use devm* here: the regulator core takes over the
* lifecycle management of the GPIO descriptor.
*/ */
switch (id) { switch (id) {
case LM3632_LDO_POS: case LM3632_LDO_POS:
return devm_gpiod_get_index_optional(dev, "enable", 0, return gpiod_get_index_optional(dev, "enable", 0,
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
case LM3632_LDO_NEG: case LM3632_LDO_NEG:
return devm_gpiod_get_index_optional(dev, "enable", 1, return gpiod_get_index_optional(dev, "enable", 1,
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
default: default:
return NULL; return NULL;
...@@ -263,6 +265,8 @@ static int lm363x_regulator_probe(struct platform_device *pdev) ...@@ -263,6 +265,8 @@ static int lm363x_regulator_probe(struct platform_device *pdev)
LM3632_EXT_EN_MASK, LM3632_EXT_EN_MASK,
LM3632_EXT_EN_MASK); LM3632_EXT_EN_MASK);
if (ret) { if (ret) {
if (gpiod)
gpiod_put(gpiod);
dev_err(dev, "External pin err: %d\n", ret); dev_err(dev, "External pin err: %d\n", ret);
return ret; return ret;
} }
......
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