diff mbox series

[v3,10/14] iio: ad7476: simplify using devm_regulator_get_enable()

Message ID 33070d66b9b976acac1cee5570facef9278b6b61.1660934107.git.mazziesaccount@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series Use devm helpers for regulator get and enable | expand

Commit Message

Matti Vaittinen Aug. 19, 2022, 7:20 p.m. UTC
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 <mazziesaccount@gmail.com>

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

Comments

Nuno Sa Aug. 30, 2022, 11:44 a.m. UTC | #1
> -----Original Message-----
> From: Matti Vaittinen <mazziesaccount@gmail.com>
> Sent: Friday, August 19, 2022 9:20 PM
> To: Matti Vaittinen <mazziesaccount@gmail.com>; Matti Vaittinen
> <matti.vaittinen@fi.rohmeurope.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>; Hennerich, Michael
> <Michael.Hennerich@analog.com>; Jonathan Cameron
> <jic23@kernel.org>; linux-iio@vger.kernel.org; linux-
> kernel@vger.kernel.org
> 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 <mazziesaccount@gmail.com>
> 
> ---

Acked-by: Nuno Sá <nuno.sa@analog.com>
Jonathan Cameron Oct. 16, 2022, 4:12 p.m. UTC | #2
On Tue, 30 Aug 2022 11:44:28 +0000
"Sa, Nuno" <Nuno.Sa@analog.com> wrote:

> > -----Original Message-----
> > From: Matti Vaittinen <mazziesaccount@gmail.com>
> > Sent: Friday, August 19, 2022 9:20 PM
> > To: Matti Vaittinen <mazziesaccount@gmail.com>; Matti Vaittinen
> > <matti.vaittinen@fi.rohmeurope.com>
> > Cc: Lars-Peter Clausen <lars@metafoo.de>; Hennerich, Michael
> > <Michael.Hennerich@analog.com>; Jonathan Cameron
> > <jic23@kernel.org>; linux-iio@vger.kernel.org; linux-
> > kernel@vger.kernel.org
> > 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 <mazziesaccount@gmail.com>
> > 
> > ---  
> 
> Acked-by: Nuno Sá <nuno.sa@analog.com>

Applied
diff mbox series

Patch

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;
 	}