Re: [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()

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

 



On Wed, Mar 24, 2021 at 09:17:23PM +0100, Uwe Kleine-König wrote:
> devm_clk_get_prepared returns the clk already prepared and the
> automatically called cleanup cares for unpreparing. So simplify .probe
> and .remove accordingly.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
> Hello,
> 
> this simplification depends on a patch set that introduces
> devm_clk_get_prepared() and friends.
> 
> The most recent version of this patch set can be found at
> 
> 	https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@xxxxxxxxxxxxxx
> 
> Unfortunately I didn't get any feedback at all from the clk maintainers
> on it, so I try to make other maintainers aware of it in the expectation
> that the simplifications are welcome and so lure the clk maintainers to
> share their thoughts.
> 
> Best regards
> Uwe
> 
>  drivers/spi/spi-davinci.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index 7453a1dbbc06..c170bccf9710 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -936,14 +936,11 @@ static int davinci_spi_probe(struct platform_device *pdev)
>  
>  	dspi->bitbang.master = master;
>  
> -	dspi->clk = devm_clk_get(&pdev->dev, NULL);
> +	dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);

oops, I got that wrong, this must be devm_clk_get_enabled, not
devm_clk_get_prepared. So if the clk patches go in, please let me resend
a fixed patch (or adapt yourself, whatever you prefer).

Best regards
Uwe

>  	if (IS_ERR(dspi->clk)) {
>  		ret = -ENODEV;
>  		goto free_master;
>  	}
> -	ret = clk_prepare_enable(dspi->clk);
> -	if (ret)
> -		goto free_master;

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux