[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtHhE6RQP6f/2NsI@lizhi-Precision-Tower-5810>
Date: Fri, 30 Aug 2024 11:11:15 -0400
From: Frank Li <Frank.li@....com>
To: Liao Yuanhong <liaoyuanhong@...o.com>
Cc: vkoul@...nel.org, dmaengine@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev
Subject: Re: [PATCH v2 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared()
helpers
On Fri, Aug 30, 2024 at 05:41:16PM +0800, Liao Yuanhong wrote:
> Use devm_clk_get_prepared() instead of clk functions in imx-sdma.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
Reviewed-by: Frank Li <Frank.Li@....com>
> ---
> v2:remove all enable related modifications, replace clk_prepare() with
> devm_clk_get_prepared()
> ---
> drivers/dma/imx-sdma.c | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 72299a08af44..07a017c40a82 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -2266,33 +2266,25 @@ static int sdma_probe(struct platform_device *pdev)
> if (IS_ERR(sdma->regs))
> return PTR_ERR(sdma->regs);
>
> - sdma->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
> + sdma->clk_ipg = devm_clk_get_prepared(&pdev->dev, "ipg");
> if (IS_ERR(sdma->clk_ipg))
> return PTR_ERR(sdma->clk_ipg);
>
> - sdma->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
> + sdma->clk_ahb = devm_clk_get_prepared(&pdev->dev, "ahb");
> if (IS_ERR(sdma->clk_ahb))
> return PTR_ERR(sdma->clk_ahb);
>
> - ret = clk_prepare(sdma->clk_ipg);
> - if (ret)
> - return ret;
> -
> - ret = clk_prepare(sdma->clk_ahb);
> - if (ret)
> - goto err_clk;
> -
> ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0,
> dev_name(&pdev->dev), sdma);
> if (ret)
> - goto err_irq;
> + return ret;
>
> sdma->irq = irq;
>
> sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL);
> if (!sdma->script_addrs) {
> ret = -ENOMEM;
> - goto err_irq;
> + return ret;
> }
>
> /* initially no scripts available */
> @@ -2407,10 +2399,6 @@ static int sdma_probe(struct platform_device *pdev)
> dma_async_device_unregister(&sdma->dma_device);
> err_init:
> kfree(sdma->script_addrs);
> -err_irq:
> - clk_unprepare(sdma->clk_ahb);
> -err_clk:
> - clk_unprepare(sdma->clk_ipg);
> return ret;
> }
>
> @@ -2422,8 +2410,6 @@ static void sdma_remove(struct platform_device *pdev)
> devm_free_irq(&pdev->dev, sdma->irq, sdma);
> dma_async_device_unregister(&sdma->dma_device);
> kfree(sdma->script_addrs);
> - clk_unprepare(sdma->clk_ahb);
> - clk_unprepare(sdma->clk_ipg);
> /* Kill the tasklet */
> for (i = 0; i < MAX_DMA_CHANNELS; i++) {
> struct sdma_channel *sdmac = &sdma->channel[i];
> --
> 2.25.1
>
Powered by blists - more mailing lists