From 0838d7cfa42536d2cdeb90074417fae33a2585a6 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 11 Sep 2026 15:04:39 -0700 Subject: [PATCH] dmaengine: fsldma: convert to platform_get_irq_optional() 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 Reviewed-by: Frank Li Link: https://patch.msgid.link/20260911220439.177474-1-rosenp@gmail.com Signed-off-by: Vinod Koul --- 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 5eca8ab23564..99a878ed1444 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1219,8 +1219,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; @@ -1241,7 +1246,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); @@ -1303,7 +1310,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); @@ -1325,7 +1331,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);