Re: [PATCH v2 2/5] dma: mcf-edma: Add per-channel IRQ naming for debugging

Frank Li
2025-11-26T16:13:01Z

On Wed, Nov 26, 2025 at 09:36:03AM +0100, Jean-Michel Hautbois via B4 Relay wrote:
> From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
>
> Add dynamic per-channel IRQ naming to make DMA interrupt identification
> easier in /proc/interrupts and debugging tools.
>
> Instead of all channels showing "eDMA", they now show:
> - "eDMA-0" through "eDMA-15" for channels 0-15
> - "eDMA-16" through "eDMA-55" for channels 16-55
> - "eDMA-tx-56" for the shared channel 56-63 interrupt
> - "eDMA-err" for the error interrupt
>
> This aids debugging DMA issues by making it clear which channel's
> interrupt is being serviced.
>
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
> ---
> drivers/dma/mcf-edma-main.c | 26 ++++++++++++++++++--------
> 1 file changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
> index f95114829d80..6a7d88895501 100644
> --- a/drivers/dma/mcf-edma-main.c
> +++ b/drivers/dma/mcf-edma-main.c
> @@ -81,8 +81,14 @@ static int mcf_edma_irq_init(struct platform_device *pdev,
> if (!res)
> return -1;
>
> - for (ret = 0, i = res->start; i <= res->end; ++i)
> - ret |= request_irq(i, mcf_edma_tx_handler, 0, "eDMA", mcf_edma);
> + for (ret = 0, i = res->start; i <= res->end; ++i) {
> + char *irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> + "eDMA-%d", (int)(i - res->start));
> + if (!irq_name)
> + return -ENOMEM;
> +
> + ret |= request_irq(i, mcf_edma_tx_handler, 0, irq_name, mcf_edma);
> + }
> if (ret)
> return ret;

The existing code have problem, it should use devm_request_irq(). if one
irq request failure, return here, requested irq will not free.

You'd better add patch before this one to change to use devm_request_irq()

Frank

>
> @@ -91,23 +97,27 @@ static int mcf_edma_irq_init(struct platform_device *pdev,
> if (!res)
> return -1;
>
> - for (ret = 0, i = res->start; i <= res->end; ++i)
> - ret |= request_irq(i, mcf_edma_tx_handler, 0, "eDMA", mcf_edma);
> + for (ret = 0, i = res->start; i <= res->end; ++i) {
> + char *irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> + "eDMA-%d", (int)(16 + i - res->start));
> + if (!irq_name)
> + return -ENOMEM;
> +
> + ret |= request_irq(i, mcf_edma_tx_handler, 0, irq_name, mcf_edma);
> + }
> if (ret)
> return ret;
>
> ret = platform_get_irq_byname(pdev, "edma-tx-56-63");
> if (ret != -ENXIO) {
> - ret = request_irq(ret, mcf_edma_tx_handler,
> - 0, "eDMA", mcf_edma);
> + ret = request_irq(ret, mcf_edma_tx_handler, 0, "eDMA-tx-56", mcf_edma);
> if (ret)
> return ret;
> }
>
> ret = platform_get_irq_byname(pdev, "edma-err");
> if (ret != -ENXIO) {
> - ret = request_irq(ret, mcf_edma_err_handler,
> - 0, "eDMA", mcf_edma);
> + ret = request_irq(ret, mcf_edma_err_handler, 0, "eDMA-err", mcf_edma);
> if (ret)
> return ret;
> }
>
> --
> 2.39.5
>
>