Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: frequency: adf4371: 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-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Uwe Kleine-König and committed by
Jonathan Cameron
3ea5b370 72336966

+1 -16
+1 -16
drivers/iio/frequency/adf4371.c
··· 540 540 return regmap_bulk_write(st->regmap, ADF4371_REG(0x30), st->buf, 5); 541 541 } 542 542 543 - static void adf4371_clk_disable(void *data) 544 - { 545 - struct adf4371_state *st = data; 546 - 547 - clk_disable_unprepare(st->clkin); 548 - } 549 - 550 543 static int adf4371_probe(struct spi_device *spi) 551 544 { 552 545 const struct spi_device_id *id = spi_get_device_id(spi); ··· 572 579 indio_dev->channels = st->chip_info->channels; 573 580 indio_dev->num_channels = st->chip_info->num_channels; 574 581 575 - st->clkin = devm_clk_get(&spi->dev, "clkin"); 582 + st->clkin = devm_clk_get_enabled(&spi->dev, "clkin"); 576 583 if (IS_ERR(st->clkin)) 577 584 return PTR_ERR(st->clkin); 578 - 579 - ret = clk_prepare_enable(st->clkin); 580 - if (ret < 0) 581 - return ret; 582 - 583 - ret = devm_add_action_or_reset(&spi->dev, adf4371_clk_disable, st); 584 - if (ret) 585 - return ret; 586 585 587 586 st->clkin_freq = clk_get_rate(st->clkin); 588 587