Commit 8bbce095 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Jonathan Cameron

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: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-1-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 71041f73
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment