mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 13:53:24 +00:00
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>
This commit is contained in:
parent
6900cdbfb9
commit
7ff0ad35aa
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user