dmaengine: xilinx: Handle IRQ mapping errors
Subsystems (2)
PATCH 1/1 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.
--- drivers/dma/xilinx/xilinx_dma.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/dma/xilinx/xilinx_dma.c +8 -3
@@ -2980,7 +2980,9 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, }/* Request the interrupt */ - chan->irq =irq_of_parse_and_map (node, chan->tdest); + chan->irq =of_irq_get (node, chan->tdest); +if (chan->irq <0 ) +return dev_err_probe (xdev->dev, chan->irq,"failed to get irq\n" ); err =request_irq (chan->irq, xdev->dma_config->irq_handler,IRQF_SHARED ,"xilinx-dma-controller" , chan);if (err) {
@@ -3054,8 +3056,11 @@ static int xilinx_dma_child_probe(struct xilinx_dma_device *xdev,if (xdev->dma_config->dmatype ==XDMA_TYPE_AXIMCDMA && ret <0 )dev_warn (xdev->dev,"missing dma-channels property\n" ); -for (i =0 ; i < nr_channels; i++) -xilinx_dma_chan_probe (xdev, node); +for (i =0 ; i < nr_channels; i++) { + ret =xilinx_dma_chan_probe (xdev, node); +if (ret) +return ret; + }return 0 ; }
Signature · 1 line
2.30.2
Quoted 15 lines
-----Original Message-----
From: Lars-Peter Clausen <[email protected]>
Sent: Wednesday, December 8, 2021 5:12 PM
To: Vinod Koul <[email protected]>
Cc: Michal Simek <[email protected]>; Radhey Shyam Pandey <[email protected]>; [email protected]; Lars-Peter Clausen <[email protected]>
Subject: [PATCH] dmaengine: xilinx: Handle IRQ mapping errorsHandle 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.
Quoted 8 lines
In order to support this switch from
irq_of_parse_and_map()toof_irq_get(), which internally does the same, but it will returnEPROBE_DEFERwhen 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 <[email protected]>
Thanks!
Quoted 39 lines
--- drivers/dma/xilinx/xilinx_dma.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/dma/xilinx/xilinx_dma.c +3
-1@@ -2980,7 +2980,9 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, }/* Request the interrupt */ - chan->irq =irq_of_parse_and_map (node, chan->tdest); + chan->irq =of_irq_get (node, chan->tdest); +if (chan->irq <0 ) +return dev_err_probe (xdev->dev, chan->irq,"failed to get irq\n"); err = request_irq(chan->irq, xdev->dma_config->irq_handler,drivers/dma/xilinx/xilinx_dma.c +5
-2IRQF_SHARED, "xilinx-dma-controller", chan);if (err) {@@ -3054,8 +3056,11 @@ static int xilinx_dma_child_probe(struct xilinx_dma_device *xdev, if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA && ret < 0)dev_warn (xdev->dev,"missing dma-channels property\n" ); -for (i =0 ; i < nr_channels; i++) -xilinx_dma_chan_probe (xdev, node); +for (i =0 ; i < nr_channels; i++) { + ret =xilinx_dma_chan_probe (xdev, node); +if (ret) +return ret; + }return 0;
}
--
2.30.2
Quoted 6 lines · Lars-Peter Clausen
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.
Quoted 6 lines
In order to support this switch from
irq_of_parse_and_map()toof_irq_get(), which internally does the same, but it will returnEPROBE_DEFERwhen 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.
Applied, thanks
Signature · 1 line
~Vinod