diff mbox series

[10/10] regulator: tps65090: Let core handle GPIO descriptors

Message ID 20181128104350.31902-11-linus.walleij@linaro.org
State New
Headers show
Series Regulator ena_gpiod fixups | expand

Commit Message

Linus Walleij Nov. 28, 2018, 10:43 a.m. UTC
Use the gpiod_get_from_of_node() rather than the devm_*
version so that the regulator core can handle the lifecycle
of these descriptors.

This patch requires "gpio: Export gpiod_get_from_of_node()"
to be applied first.

Fixes: 3012e81446d0 ("regulator: tps65090: Pass descriptor instead of GPIO number")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/regulator/tps65090-regulator.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.19.1

Comments

Charles Keepax Nov. 28, 2018, 3:18 p.m. UTC | #1
On Wed, Nov 28, 2018 at 11:43:50AM +0100, Linus Walleij wrote:
> Use the gpiod_get_from_of_node() rather than the devm_*

> version so that the regulator core can handle the lifecycle

> of these descriptors.

> 

> This patch requires "gpio: Export gpiod_get_from_of_node()"

> to be applied first.

> 

> Fixes: 3012e81446d0 ("regulator: tps65090: Pass descriptor instead of GPIO number")

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

>  drivers/regulator/tps65090-regulator.c | 10 +++++-----

>  1 file changed, 5 insertions(+), 5 deletions(-)

> 

> diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c

> index db714d5edafc..223f6974a9f3 100644

> --- a/drivers/regulator/tps65090-regulator.c

> +++ b/drivers/regulator/tps65090-regulator.c

> @@ -376,11 +376,11 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data(

>  				gflags = GPIOD_OUT_LOW;

>  			gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;

>  

> -			rpdata->gpiod = devm_gpiod_get_from_of_node(&pdev->dev,

> -								    tps65090_matches[idx].of_node,

> -								    "dcdc-ext-control-gpios", 0,

> -								    gflags,

> -								    "tps65090");

> +			rpdata->gpiod = gpiod_get_from_of_node(

> +						tps65090_matches[idx].of_node,

> +						"dcdc-ext-control-gpios", 0,

> +						gflags,

> +						"tps65090");

>  			if (IS_ERR(rpdata->gpiod))

>  				return ERR_CAST(rpdata->gpiod);

>  			if (!rpdata->gpiod)


This one needs some handling to avoid leaking the gpio too.

Thanks,
Charles
diff mbox series

Patch

diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index db714d5edafc..223f6974a9f3 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -376,11 +376,11 @@  static struct tps65090_platform_data *tps65090_parse_dt_reg_data(
 				gflags = GPIOD_OUT_LOW;
 			gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
 
-			rpdata->gpiod = devm_gpiod_get_from_of_node(&pdev->dev,
-								    tps65090_matches[idx].of_node,
-								    "dcdc-ext-control-gpios", 0,
-								    gflags,
-								    "tps65090");
+			rpdata->gpiod = gpiod_get_from_of_node(
+						tps65090_matches[idx].of_node,
+						"dcdc-ext-control-gpios", 0,
+						gflags,
+						"tps65090");
 			if (IS_ERR(rpdata->gpiod))
 				return ERR_CAST(rpdata->gpiod);
 			if (!rpdata->gpiod)