2022-08-19 19:35:44

by Matti Vaittinen

[permalink] [raw]
Subject: [PATCH v3 10/14] iio: ad7476: simplify using devm_regulator_get_enable()

Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable()

Signed-off-by: Matti Vaittinen <[email protected]>

---
v2 => v3:
New patch
---
drivers/iio/adc/ad7476.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index 94776f696290..80aebed47d1f 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -368,16 +368,7 @@ static int ad7476_probe(struct spi_device *spi)
}

if (st->chip_info->has_vdrive) {
- reg = devm_regulator_get(&spi->dev, "vdrive");
- if (IS_ERR(reg))
- return PTR_ERR(reg);
-
- ret = regulator_enable(reg);
- if (ret)
- return ret;
-
- ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable,
- reg);
+ ret = devm_regulator_get_enable(&spi->dev, "vdrive");
if (ret)
return ret;
}
--
2.37.1


--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]


Attachments:
(No filename) (1.30 kB)
signature.asc (499.00 B)
Download all attachments

2022-08-30 11:58:09

by Nuno Sa

[permalink] [raw]
Subject: RE: [PATCH v3 10/14] iio: ad7476: simplify using devm_regulator_get_enable()



> -----Original Message-----
> From: Matti Vaittinen <[email protected]>
> Sent: Friday, August 19, 2022 9:20 PM
> To: Matti Vaittinen <[email protected]>; Matti Vaittinen
> <[email protected]>
> Cc: Lars-Peter Clausen <[email protected]>; Hennerich, Michael
> <[email protected]>; Jonathan Cameron
> <[email protected]>; [email protected]; linux-
> [email protected]
> Subject: [PATCH v3 10/14] iio: ad7476: simplify using
> devm_regulator_get_enable()
>
> [External]
>
> Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> add_action_or_reset(regulator_disable)' and use the
> devm_regulator_get_enable()
>
> Signed-off-by: Matti Vaittinen <[email protected]>
>
> ---

Acked-by: Nuno S? <[email protected]>

2022-10-16 16:24:41

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v3 10/14] iio: ad7476: simplify using devm_regulator_get_enable()

On Tue, 30 Aug 2022 11:44:28 +0000
"Sa, Nuno" <[email protected]> wrote:

> > -----Original Message-----
> > From: Matti Vaittinen <[email protected]>
> > Sent: Friday, August 19, 2022 9:20 PM
> > To: Matti Vaittinen <[email protected]>; Matti Vaittinen
> > <[email protected]>
> > Cc: Lars-Peter Clausen <[email protected]>; Hennerich, Michael
> > <[email protected]>; Jonathan Cameron
> > <[email protected]>; [email protected]; linux-
> > [email protected]
> > Subject: [PATCH v3 10/14] iio: ad7476: simplify using
> > devm_regulator_get_enable()
> >
> > [External]
> >
> > Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
> > add_action_or_reset(regulator_disable)' and use the
> > devm_regulator_get_enable()
> >
> > Signed-off-by: Matti Vaittinen <[email protected]>
> >
> > ---
>
> Acked-by: Nuno Sá <[email protected]>

Applied