iio: adc: ti-ads131e08: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Uwe Kleine-König 2022-08-08 22:47:34 +02:00 committed by Jonathan Cameron
parent 4004912e0c
commit dcb9bd105c
1 changed files with 1 additions and 18 deletions

View File

@ -797,13 +797,6 @@ static void ads131e08_regulator_disable(void *data)
regulator_disable(st->vref_reg);
}
static void ads131e08_clk_disable(void *data)
{
struct ads131e08_state *st = data;
clk_disable_unprepare(st->adc_clk);
}
static int ads131e08_probe(struct spi_device *spi)
{
const struct ads131e08_info *info;
@ -896,21 +889,11 @@ static int ads131e08_probe(struct spi_device *spi)
st->vref_reg = NULL;
}
st->adc_clk = devm_clk_get(&spi->dev, "adc-clk");
st->adc_clk = devm_clk_get_enabled(&spi->dev, "adc-clk");
if (IS_ERR(st->adc_clk))
return dev_err_probe(&spi->dev, PTR_ERR(st->adc_clk),
"failed to get the ADC clock\n");
ret = clk_prepare_enable(st->adc_clk);
if (ret) {
dev_err(&spi->dev, "failed to prepare/enable the ADC clock\n");
return ret;
}
ret = devm_add_action_or_reset(&spi->dev, ads131e08_clk_disable, st);
if (ret)
return ret;
adc_clk_hz = clk_get_rate(st->adc_clk);
if (!adc_clk_hz) {
dev_err(&spi->dev, "failed to get the ADC clock rate\n");