summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/ad7476.c
diff options
context:
space:
mode:
authorMatti Vaittinen <mazziesaccount@gmail.com>2022-08-19 21:20:03 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-11-23 20:44:00 +0100
commit7ff0ad35aa6f70fe32fee33bc6e0aa356af99f76 (patch)
tree3d0fd48cc57176e0691bce4d4861086f6fa8d868 /drivers/iio/adc/ad7476.c
parentiio: imu: st_lsm6dsx: Simplify using devm_regulator_*get_enable() (diff)
downloadlinux-7ff0ad35aa6f70fe32fee33bc6e0aa356af99f76.tar.xz
linux-7ff0ad35aa6f70fe32fee33bc6e0aa356af99f76.zip
iio: adc: 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 <mazziesaccount@gmail.com> Acked-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/33070d66b9b976acac1cee5570facef9278b6b61.1660934107.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/ad7476.c')
-rw-r--r--drivers/iio/adc/ad7476.c11
1 files changed, 1 insertions, 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;
}