mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCHv3] dmaengine: fsldma: convert to platform_get_irq_optional()
@ 2026-09-11 22:04 Rosen Penev
  2026-09-14 15:49 ` Frank Li
  2026-09-15 17:36 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Rosen Penev @ 2026-09-11 22:04 UTC (permalink / raw)
  To: dmaengine
  Cc: Zhang Wei, Vinod Koul, Frank Li, open list:FREESCALE DMA DRIVER,
	open list

Replace the per-controller irq_of_parse_and_map() call with
platform_get_irq_optional(). The controller IRQ is optional when absent
and the driver falls back to per-channel IRQs. The corresponding
irq_dispose_mapping() calls in the probe error path and remove function
are removed.

Moved before anything else in order to handle -EPROBE_DEFER and to avoid
doing extra work. Simplifies the if statements as well.

Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v3: fix build error from the move
 v2: move to the front of probe.
 drivers/dma/fsldma.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index fb19c60540be..6db2c4d284c9 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1224,8 +1224,13 @@ static int fsldma_of_probe(struct platform_device *op)
 	struct fsldma_device *fdev;
 	struct device_node *child;
 	unsigned int i;
+	int irq;
 	int err;
 
+	irq = platform_get_irq_optional(op, 0);
+	if (irq == -EPROBE_DEFER)
+		return irq;
+
 	fdev = kzalloc_obj(*fdev);
 	if (!fdev) {
 		err = -ENOMEM;
@@ -1246,7 +1251,9 @@ static int fsldma_of_probe(struct platform_device *op)
 	}
 
 	/* map the channel IRQ if it exists, but don't hookup the handler yet */
-	fdev->irq = irq_of_parse_and_map(op->dev.of_node, 0);
+	fdev->irq = irq;
+	if (fdev->irq < 0)
+		fdev->irq = 0;
 
 	dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
 	dma_cap_set(DMA_SLAVE, fdev->common.cap_mask);
@@ -1308,7 +1315,6 @@ static int fsldma_of_probe(struct platform_device *op)
 		if (fdev->chan[i])
 			fsl_dma_chan_remove(fdev->chan[i]);
 	}
-	irq_dispose_mapping(fdev->irq);
 	iounmap(fdev->regs);
 out_free:
 	kfree(fdev);
@@ -1330,7 +1336,6 @@ static void fsldma_of_remove(struct platform_device *op)
 		if (fdev->chan[i])
 			fsl_dma_chan_remove(fdev->chan[i]);
 	}
-	irq_dispose_mapping(fdev->irq);
 
 	iounmap(fdev->regs);
 	kfree(fdev);
-- 
2.55.0


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

* Re: [PATCHv3] dmaengine: fsldma: convert to platform_get_irq_optional()
  2026-09-11 22:04 [PATCHv3] dmaengine: fsldma: convert to platform_get_irq_optional() Rosen Penev
@ 2026-09-14 15:49 ` Frank Li
  2026-09-15 17:36 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-09-14 15:49 UTC (permalink / raw)
  To: Rosen Penev
  Cc: dmaengine, Zhang Wei, Vinod Koul, Frank Li,
	open list:FREESCALE DMA DRIVER, open list

On Fri, Sep 11, 2026 at 03:04:39PM -0700, Rosen Penev wrote:
> Replace the per-controller irq_of_parse_and_map() call with
> platform_get_irq_optional(). The controller IRQ is optional when absent
> and the driver falls back to per-channel IRQs. The corresponding
> irq_dispose_mapping() calls in the probe error path and remove function
> are removed.
>
> Moved before anything else in order to handle -EPROBE_DEFER and to avoid
> doing extra work. Simplifies the if statements as well.
>
> Assisted-by: LLM
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---

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

>  v3: fix build error from the move
>  v2: move to the front of probe.
>  drivers/dma/fsldma.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index fb19c60540be..6db2c4d284c9 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -1224,8 +1224,13 @@ static int fsldma_of_probe(struct platform_device *op)
>  	struct fsldma_device *fdev;
>  	struct device_node *child;
>  	unsigned int i;
> +	int irq;
>  	int err;
>
> +	irq = platform_get_irq_optional(op, 0);
> +	if (irq == -EPROBE_DEFER)
> +		return irq;
> +
>  	fdev = kzalloc_obj(*fdev);
>  	if (!fdev) {
>  		err = -ENOMEM;
> @@ -1246,7 +1251,9 @@ static int fsldma_of_probe(struct platform_device *op)
>  	}
>
>  	/* map the channel IRQ if it exists, but don't hookup the handler yet */
> -	fdev->irq = irq_of_parse_and_map(op->dev.of_node, 0);
> +	fdev->irq = irq;
> +	if (fdev->irq < 0)
> +		fdev->irq = 0;
>
>  	dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
>  	dma_cap_set(DMA_SLAVE, fdev->common.cap_mask);
> @@ -1308,7 +1315,6 @@ static int fsldma_of_probe(struct platform_device *op)
>  		if (fdev->chan[i])
>  			fsl_dma_chan_remove(fdev->chan[i]);
>  	}
> -	irq_dispose_mapping(fdev->irq);
>  	iounmap(fdev->regs);
>  out_free:
>  	kfree(fdev);
> @@ -1330,7 +1336,6 @@ static void fsldma_of_remove(struct platform_device *op)
>  		if (fdev->chan[i])
>  			fsl_dma_chan_remove(fdev->chan[i]);
>  	}
> -	irq_dispose_mapping(fdev->irq);
>
>  	iounmap(fdev->regs);
>  	kfree(fdev);
> --
> 2.55.0
>

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

* Re: [PATCHv3] dmaengine: fsldma: convert to platform_get_irq_optional()
  2026-09-11 22:04 [PATCHv3] dmaengine: fsldma: convert to platform_get_irq_optional() Rosen Penev
  2026-09-14 15:49 ` Frank Li
@ 2026-09-15 17:36 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2026-09-15 17:36 UTC (permalink / raw)
  To: dmaengine, Rosen Penev; +Cc: Zhang Wei, Frank Li, linuxppc-dev, linux-kernel


On Fri, 11 Sep 2026 15:04:39 -0700, Rosen Penev wrote:
> Replace the per-controller irq_of_parse_and_map() call with
> platform_get_irq_optional(). The controller IRQ is optional when absent
> and the driver falls back to per-channel IRQs. The corresponding
> irq_dispose_mapping() calls in the probe error path and remove function
> are removed.
> 
> Moved before anything else in order to handle -EPROBE_DEFER and to avoid
> doing extra work. Simplifies the if statements as well.
> 
> [...]

Applied, thanks!

[1/1] dmaengine: fsldma: convert to platform_get_irq_optional()
      commit: 0838d7cfa42536d2cdeb90074417fae33a2585a6

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2026-09-15 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 22:04 [PATCHv3] dmaengine: fsldma: convert to platform_get_irq_optional() Rosen Penev
2026-09-14 15:49 ` Frank Li
2026-09-15 17:36 ` Vinod Koul

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

all inboxes | Powered by JetHome®