Commit 33dae107 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Jonathan Cameron

iio: imu: adis16475: 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-13-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 129a90cf
......@@ -1120,11 +1120,6 @@ static irqreturn_t adis16475_trigger_handler(int irq, void *p)
return IRQ_HANDLED;
}
static void adis16475_disable_clk(void *data)
{
clk_disable_unprepare((struct clk *)data);
}
static int adis16475_config_sync_mode(struct adis16475 *st)
{
int ret;
......@@ -1150,19 +1145,11 @@ static int adis16475_config_sync_mode(struct adis16475 *st)
/* All the other modes require external input signal */
if (sync->sync_mode != ADIS16475_SYNC_OUTPUT) {
struct clk *clk = devm_clk_get(dev, NULL);
struct clk *clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(clk))
return PTR_ERR(clk);
ret = clk_prepare_enable(clk);
if (ret)
return ret;
ret = devm_add_action_or_reset(dev, adis16475_disable_clk, clk);
if (ret)
return ret;
st->clk_freq = clk_get_rate(clk);
if (st->clk_freq < sync->min_rate ||
st->clk_freq > sync->max_rate) {
......
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