iio: adc: ad7124: 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-1-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:28 +02:00 committed by Jonathan Cameron
parent 71041f73dc
commit 8bbce0954f
1 changed files with 1 additions and 14 deletions

View File

@ -936,11 +936,6 @@ static void ad7124_reg_disable(void *r)
regulator_disable(r);
}
static void ad7124_clk_disable(void *c)
{
clk_disable_unprepare(c);
}
static int ad7124_probe(struct spi_device *spi)
{
const struct ad7124_chip_info *info;
@ -993,18 +988,10 @@ static int ad7124_probe(struct spi_device *spi)
return ret;
}
st->mclk = devm_clk_get(&spi->dev, "mclk");
st->mclk = devm_clk_get_enabled(&spi->dev, "mclk");
if (IS_ERR(st->mclk))
return PTR_ERR(st->mclk);
ret = clk_prepare_enable(st->mclk);
if (ret < 0)
return ret;
ret = devm_add_action_or_reset(&spi->dev, ad7124_clk_disable, st->mclk);
if (ret)
return ret;
ret = ad7124_soft_reset(st);
if (ret < 0)
return ret;