Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: xilinx: Handle IRQ mapping errors

Handle errors when trying to map the IRQ for the DMA channels.

The main motivation here is to be able to handle probe deferral. E.g. when
using DT overlays it is possible that the DMA controller is probed before
interrupt controller, depending on the order in the DT.

In order to support this switch from irq_of_parse_and_map() to
of_irq_get(), which internally does the same, but it will return
EPROBE_DEFER when the interrupt controller is not yet available.

As a result other errors, such as an invalid IRQ specification, or missing
IRQ are also properly handled.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Link: https://lore.kernel.org/r/20211208114212.234130-1-lars@metafoo.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Lars-Peter Clausen and committed by
Vinod Koul
f17e5338 7eafa6ee

+8 -3
+8 -3
drivers/dma/xilinx/xilinx_dma.c
··· 2980 2980 } 2981 2981 2982 2982 /* Request the interrupt */ 2983 - chan->irq = irq_of_parse_and_map(node, chan->tdest); 2983 + chan->irq = of_irq_get(node, chan->tdest); 2984 + if (chan->irq < 0) 2985 + return dev_err_probe(xdev->dev, chan->irq, "failed to get irq\n"); 2984 2986 err = request_irq(chan->irq, xdev->dma_config->irq_handler, 2985 2987 IRQF_SHARED, "xilinx-dma-controller", chan); 2986 2988 if (err) { ··· 3056 3054 if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA && ret < 0) 3057 3055 dev_warn(xdev->dev, "missing dma-channels property\n"); 3058 3056 3059 - for (i = 0; i < nr_channels; i++) 3060 - xilinx_dma_chan_probe(xdev, node); 3057 + for (i = 0; i < nr_channels; i++) { 3058 + ret = xilinx_dma_chan_probe(xdev, node); 3059 + if (ret) 3060 + return ret; 3061 + } 3061 3062 3062 3063 return 0; 3063 3064 }