Re: [PATCH 11/13] iio: frequency: admv1013: Benefit from devm_clk_get_enabled() to simplify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon,  8 Aug 2022 22:47:38 +0200
Uwe Kleine-König         <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:

> Make use of devm_clk_get_enabled() to replace some code that effectively
> open codes this new function.
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
Looks fine to me, but there is a subtle reordering + it does even more
non parsing stuff in a function called _parse.

Anyhow, would like Antoniu or someone else from ADI to take a quick look if
possible before I pick this one up.

> ---
>  drivers/iio/frequency/admv1013.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c
> index b0e1f6571afb..1346d77df77f 100644
> --- a/drivers/iio/frequency/admv1013.c
> +++ b/drivers/iio/frequency/admv1013.c
> @@ -490,11 +490,6 @@ static int admv1013_init(struct admv1013_state *st)
>  					  st->input_mode);
>  }
>  
> -static void admv1013_clk_disable(void *data)
> -{
> -	clk_disable_unprepare(data);
> -}
> -
>  static void admv1013_reg_disable(void *data)
>  {
>  	regulator_disable(data);
> @@ -559,7 +554,7 @@ static int admv1013_properties_parse(struct admv1013_state *st)
>  		return dev_err_probe(&spi->dev, PTR_ERR(st->reg),
>  				     "failed to get the common-mode voltage\n");
>  
> -	st->clkin = devm_clk_get(&spi->dev, "lo_in");
> +	st->clkin = devm_clk_get_enabled(&spi->dev, "lo_in");
>  	if (IS_ERR(st->clkin))
>  		return dev_err_probe(&spi->dev, PTR_ERR(st->clkin),
>  				     "failed to get the LO input clock\n");
> @@ -601,14 +596,6 @@ static int admv1013_probe(struct spi_device *spi)
>  	if (ret)
>  		return ret;
>  
> -	ret = clk_prepare_enable(st->clkin);
> -	if (ret)
> -		return ret;
> -
> -	ret = devm_add_action_or_reset(&spi->dev, admv1013_clk_disable, st->clkin);
> -	if (ret)
> -		return ret;
> -
>  	st->nb.notifier_call = admv1013_freq_change;
>  	ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
>  	if (ret)





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux