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: 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-13-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Родитель
129a90cf81
Коммит
33dae107b6
|
@ -1120,11 +1120,6 @@ check_burst32:
|
|||
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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче