iio: frequency: adrf6780: 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-12-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:39 +02:00 committed by Jonathan Cameron
parent 3ea5b370af
commit 129a90cf81

View File

@ -441,11 +441,6 @@ static void adrf6780_properties_parse(struct adrf6780_state *st)
st->vdet_out_en = device_property_read_bool(&spi->dev, "adi,vdet-out-en"); st->vdet_out_en = device_property_read_bool(&spi->dev, "adi,vdet-out-en");
} }
static void adrf6780_clk_disable(void *data)
{
clk_disable_unprepare(data);
}
static void adrf6780_powerdown(void *data) static void adrf6780_powerdown(void *data)
{ {
/* Disable all components in the Enable Register */ /* Disable all components in the Enable Register */
@ -473,20 +468,11 @@ static int adrf6780_probe(struct spi_device *spi)
adrf6780_properties_parse(st); adrf6780_properties_parse(st);
st->clkin = devm_clk_get(&spi->dev, "lo_in"); st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in");
if (IS_ERR(st->clkin)) if (IS_ERR(st->clkin))
return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
"failed to get the LO input clock\n"); "failed to get the LO input clock\n");
ret = clk_prepare_enable(st->clkin);
if (ret)
return ret;
ret = devm_add_action_or_reset(&spi->dev, adrf6780_clk_disable,
st->clkin);
if (ret)
return ret;
mutex_init(&st->lock); mutex_init(&st->lock);
ret = adrf6780_init(st); ret = adrf6780_init(st);