Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled()
@ 2026-09-08 21:26 Rosen Penev
  2026-09-09 15:54 ` Frank Li
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rosen Penev @ 2026-09-08 21:26 UTC (permalink / raw)
  To: dmaengine
  Cc: Ludovic Desroches, Vinod Koul, Frank Li,
	moderated list:MICROCHIP AT91 DMA DRIVERS, open list

Replace the devm_clk_get() + clk_prepare_enable() pair with
devm_clk_get_enabled(), which handles enable/disable and the
unprepare on driver detach automatically.  This lets us drop the
err_irq cleanup label and the clk_disable_unprepare() calls in
probe error paths and at_dma_remove().

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/dma/at_hdmac.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f4d0c72787d1..cae26ea890fa 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1994,20 +1994,16 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	atdma->dma_device.cap_mask = plat_dat->cap_mask;
 	atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
 
-	atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
+	atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
 	if (IS_ERR(atdma->clk))
 		return PTR_ERR(atdma->clk);
 
-	err = clk_prepare_enable(atdma->clk);
-	if (err)
-		return err;
-
 	/* force dma off, just in case */
 	at_dma_off(atdma);
 
 	err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
 	if (err)
-		goto err_irq;
+		return err;
 
 	platform_set_drvdata(pdev, atdma);
 
@@ -2126,8 +2122,6 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_pool_destroy(atdma->lli_pool);
 err_desc_pool_create:
 	free_irq(irq, atdma);
-err_irq:
-	clk_disable_unprepare(atdma->clk);
 	return err;
 }
 
@@ -2145,8 +2139,6 @@ static void at_dma_remove(struct platform_device *pdev)
 	at_dma_cleanup_channels(atdma);
 	dma_pool_destroy(atdma->memset_pool);
 	dma_pool_destroy(atdma->lli_pool);
-
-	clk_disable_unprepare(atdma->clk);
 }
 
 static void at_dma_shutdown(struct platform_device *pdev)
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled()
  2026-09-08 21:26 [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled() Rosen Penev
@ 2026-09-09 15:54 ` Frank Li
  2026-09-09 15:55 ` Frank Li
  2026-09-10 14:10 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-09-09 15:54 UTC (permalink / raw)
  To: Rosen Penev
  Cc: dmaengine, Ludovic Desroches, Vinod Koul, Frank Li,
	moderated list:MICROCHIP AT91 DMA DRIVERS, open list

On Tue, Sep 08, 2026 at 02:26:07PM -0700, Rosen Penev wrote:
> Replace the devm_clk_get() + clk_prepare_enable() pair with
> devm_clk_get_enabled(), which handles enable/disable and the
> unprepare on driver detach automatically.  This lets us drop the
> err_irq cleanup label and the clk_disable_unprepare() calls in
> probe error paths and at_dma_remove().
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/dma/at_hdmac.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index f4d0c72787d1..cae26ea890fa 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1994,20 +1994,16 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	atdma->dma_device.cap_mask = plat_dat->cap_mask;
>  	atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
>
> -	atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
> +	atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
>  	if (IS_ERR(atdma->clk))
>  		return PTR_ERR(atdma->clk);
>
> -	err = clk_prepare_enable(atdma->clk);
> -	if (err)
> -		return err;
> -
>  	/* force dma off, just in case */
>  	at_dma_off(atdma);
>
>  	err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
>  	if (err)
> -		goto err_irq;
> +		return err;
>
>  	platform_set_drvdata(pdev, atdma);
>
> @@ -2126,8 +2122,6 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dma_pool_destroy(atdma->lli_pool);
>  err_desc_pool_create:
>  	free_irq(irq, atdma);
> -err_irq:
> -	clk_disable_unprepare(atdma->clk);
>  	return err;
>  }
>
> @@ -2145,8 +2139,6 @@ static void at_dma_remove(struct platform_device *pdev)
>  	at_dma_cleanup_channels(atdma);
>  	dma_pool_destroy(atdma->memset_pool);
>  	dma_pool_destroy(atdma->lli_pool);
> -
> -	clk_disable_unprepare(atdma->clk);
>  }
>
>  static void at_dma_shutdown(struct platform_device *pdev)
> --
> 2.55.0
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled()
  2026-09-08 21:26 [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled() Rosen Penev
  2026-09-09 15:54 ` Frank Li
@ 2026-09-09 15:55 ` Frank Li
  2026-09-10 14:10 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-09-09 15:55 UTC (permalink / raw)
  To: Rosen Penev
  Cc: dmaengine, Ludovic Desroches, Vinod Koul, Frank Li,
	moderated list:MICROCHIP AT91 DMA DRIVERS, open list

On Tue, Sep 08, 2026 at 02:26:07PM -0700, Rosen Penev wrote:
> Replace the devm_clk_get() + clk_prepare_enable() pair with
> devm_clk_get_enabled(), which handles enable/disable and the
> unprepare on driver detach automatically.  This lets us drop the
> err_irq cleanup label and the clk_disable_unprepare() calls in
> probe error paths and at_dma_remove().
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/dma/at_hdmac.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index f4d0c72787d1..cae26ea890fa 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1994,20 +1994,16 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	atdma->dma_device.cap_mask = plat_dat->cap_mask;
>  	atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
>
> -	atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
> +	atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
>  	if (IS_ERR(atdma->clk))
>  		return PTR_ERR(atdma->clk);
>
> -	err = clk_prepare_enable(atdma->clk);
> -	if (err)
> -		return err;
> -
>  	/* force dma off, just in case */
>  	at_dma_off(atdma);
>
>  	err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
>  	if (err)
> -		goto err_irq;
> +		return err;
>
>  	platform_set_drvdata(pdev, atdma);
>
> @@ -2126,8 +2122,6 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	dma_pool_destroy(atdma->lli_pool);
>  err_desc_pool_create:
>  	free_irq(irq, atdma);
> -err_irq:
> -	clk_disable_unprepare(atdma->clk);
>  	return err;
>  }
>
> @@ -2145,8 +2139,6 @@ static void at_dma_remove(struct platform_device *pdev)
>  	at_dma_cleanup_channels(atdma);
>  	dma_pool_destroy(atdma->memset_pool);
>  	dma_pool_destroy(atdma->lli_pool);
> -
> -	clk_disable_unprepare(atdma->clk);
>  }
>
>  static void at_dma_shutdown(struct platform_device *pdev)
> --
> 2.55.0
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled()
  2026-09-08 21:26 [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled() Rosen Penev
  2026-09-09 15:54 ` Frank Li
  2026-09-09 15:55 ` Frank Li
@ 2026-09-10 14:10 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2026-09-10 14:10 UTC (permalink / raw)
  To: dmaengine, Rosen Penev
  Cc: Ludovic Desroches, Frank Li, linux-arm-kernel, linux-kernel


On Tue, 08 Sep 2026 14:26:07 -0700, Rosen Penev wrote:
> Replace the devm_clk_get() + clk_prepare_enable() pair with
> devm_clk_get_enabled(), which handles enable/disable and the
> unprepare on driver detach automatically.  This lets us drop the
> err_irq cleanup label and the clk_disable_unprepare() calls in
> probe error paths and at_dma_remove().
> 
> 
> [...]

Applied, thanks!

[1/1] dmaengine: at_hdmac: use devm_clk_get_enabled()
      commit: d882935a2ca4457f6f446b02d7d08134cd9d4582

Best regards,
-- 
~Vinod




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-10 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 21:26 [PATCH] dmaengine: at_hdmac: use devm_clk_get_enabled() Rosen Penev
2026-09-09 15:54 ` Frank Li
2026-09-09 15:55 ` Frank Li
2026-09-10 14:10 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox