* [PATCH 1/3] dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt
2021-12-22 16:15 [PATCH 0/3] dmaengine: Use platform_get_irq*() variants to fetch IRQ's Lad Prabhakar
@ 2021-12-22 16:15 ` Lad Prabhakar
2021-12-25 17:46 ` Andy Shevchenko
2021-12-22 16:15 ` [PATCH 2/3] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() " Lad Prabhakar
2021-12-22 16:15 ` [PATCH 3/3] dmaengine: mediatek-cqdma: " Lad Prabhakar
2 siblings, 1 reply; 6+ messages in thread
From: Lad Prabhakar @ 2021-12-22 16:15 UTC (permalink / raw)
To: Sean Wang, Vinod Koul, Matthias Brugger, dmaengine,
linux-arm-kernel, linux-mediatek
Cc: Rob Herring, linux-kernel, linux-renesas-soc, Prabhakar, Lad Prabhakar
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.
In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq_optional().
There are no non-DT users for this driver so interrupt range
(irq_res->start-irq_res->end) is no longer required and with DT we will
be sure it will be a single IRQ resource for each index.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/dma/nbpfaxi.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c
index 9c52c57919c6..135c12b0a2df 100644
--- a/drivers/dma/nbpfaxi.c
+++ b/drivers/dma/nbpfaxi.c
@@ -1294,7 +1294,7 @@ static int nbpf_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
struct nbpf_device *nbpf;
struct dma_device *dma_dev;
- struct resource *iomem, *irq_res;
+ struct resource *iomem;
const struct nbpf_config *cfg;
int num_channels;
int ret, irq, eirq, i;
@@ -1335,13 +1335,12 @@ static int nbpf_probe(struct platform_device *pdev)
nbpf->config = cfg;
for (i = 0; irqs < ARRAY_SIZE(irqbuf); i++) {
- irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
- if (!irq_res)
+ irq = platform_get_irq_optional(pdev, i);
+ if (irq == -ENXIO)
break;
-
- for (irq = irq_res->start; irq <= irq_res->end;
- irq++, irqs++)
- irqbuf[irqs] = irq;
+ if (irq < 0)
+ return irq;
+ irqbuf[irqs++] = irq;
}
/*
--
2.17.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt
2021-12-22 16:15 ` [PATCH 1/3] dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
@ 2021-12-25 17:46 ` Andy Shevchenko
2021-12-25 23:50 ` Lad, Prabhakar
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-12-25 17:46 UTC (permalink / raw)
To: Lad Prabhakar
Cc: Sean Wang, Vinod Koul, Matthias Brugger, dmaengine,
linux-arm Mailing List, moderated list:ARM/Mediatek SoC support,
Rob Herring, Linux Kernel Mailing List, Linux-Renesas, Prabhakar
On Fri, Dec 24, 2021 at 3:14 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
>
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
>
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq_optional().
>
> There are no non-DT users for this driver so interrupt range
> (irq_res->start-irq_res->end) is no longer required and with DT we will
> be sure it will be a single IRQ resource for each index.
> for (i = 0; irqs < ARRAY_SIZE(irqbuf); i++) {
> - irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
> - if (!irq_res)
> + irq = platform_get_irq_optional(pdev, i);
> + if (irq == -ENXIO)
> break;
> -
> - for (irq = irq_res->start; irq <= irq_res->end;
> - irq++, irqs++)
> - irqbuf[irqs] = irq;
> + if (irq < 0)
> + return irq;
> + irqbuf[irqs++] = irq;
> }
Same comment as per other patch(es), i.e. consider 0 as no IRQ.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt
2021-12-25 17:46 ` Andy Shevchenko
@ 2021-12-25 23:50 ` Lad, Prabhakar
0 siblings, 0 replies; 6+ messages in thread
From: Lad, Prabhakar @ 2021-12-25 23:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lad Prabhakar, Sean Wang, Vinod Koul, Matthias Brugger,
dmaengine, linux-arm Mailing List,
moderated list:ARM/Mediatek SoC support, Rob Herring,
Linux Kernel Mailing List, Linux-Renesas
Hi Andy,
Thank you for the review.
On Sat, Dec 25, 2021 at 5:47 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Fri, Dec 24, 2021 at 3:14 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> >
> > platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> > allocation of IRQ resources in DT core code, this causes an issue
> > when using hierarchical interrupt domains using "interrupts" property
> > in the node as this bypasses the hierarchical setup and messes up the
> > irq chaining.
> >
> > In preparation for removal of static setup of IRQ resource from DT core
> > code use platform_get_irq_optional().
> >
> > There are no non-DT users for this driver so interrupt range
> > (irq_res->start-irq_res->end) is no longer required and with DT we will
> > be sure it will be a single IRQ resource for each index.
>
> > for (i = 0; irqs < ARRAY_SIZE(irqbuf); i++) {
> > - irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
> > - if (!irq_res)
> > + irq = platform_get_irq_optional(pdev, i);
> > + if (irq == -ENXIO)
> > break;
> > -
> > - for (irq = irq_res->start; irq <= irq_res->end;
> > - irq++, irqs++)
> > - irqbuf[irqs] = irq;
> > + if (irq < 0)
> > + return irq;
> > + irqbuf[irqs++] = irq;
> > }
>
> Same comment as per other patch(es), i.e. consider 0 as no IRQ.
>
Will do.
Cheers,
Prabhakar
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt
2021-12-22 16:15 [PATCH 0/3] dmaengine: Use platform_get_irq*() variants to fetch IRQ's Lad Prabhakar
2021-12-22 16:15 ` [PATCH 1/3] dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
@ 2021-12-22 16:15 ` Lad Prabhakar
2021-12-22 16:15 ` [PATCH 3/3] dmaengine: mediatek-cqdma: " Lad Prabhakar
2 siblings, 0 replies; 6+ messages in thread
From: Lad Prabhakar @ 2021-12-22 16:15 UTC (permalink / raw)
To: Sean Wang, Vinod Koul, Matthias Brugger, dmaengine,
linux-arm-kernel, linux-mediatek
Cc: Rob Herring, linux-kernel, linux-renesas-soc, Prabhakar, Lad Prabhakar
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.
In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/dma/mediatek/mtk-hsdma.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c
index 6ad8afbb95f2..c0fffde7fe08 100644
--- a/drivers/dma/mediatek/mtk-hsdma.c
+++ b/drivers/dma/mediatek/mtk-hsdma.c
@@ -923,13 +923,10 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
return PTR_ERR(hsdma->clk);
}
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!res) {
- dev_err(&pdev->dev, "No irq resource for %s\n",
- dev_name(&pdev->dev));
- return -EINVAL;
- }
- hsdma->irq = res->start;
+ err = platform_get_irq(pdev, 0);
+ if (err < 0)
+ return err;
+ hsdma->irq = err;
refcount_set(&hsdma->pc_refcnt, 0);
spin_lock_init(&hsdma->lock);
--
2.17.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] dmaengine: mediatek-cqdma: Use platform_get_irq() to get the interrupt
2021-12-22 16:15 [PATCH 0/3] dmaengine: Use platform_get_irq*() variants to fetch IRQ's Lad Prabhakar
2021-12-22 16:15 ` [PATCH 1/3] dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
2021-12-22 16:15 ` [PATCH 2/3] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() " Lad Prabhakar
@ 2021-12-22 16:15 ` Lad Prabhakar
2 siblings, 0 replies; 6+ messages in thread
From: Lad Prabhakar @ 2021-12-22 16:15 UTC (permalink / raw)
To: Sean Wang, Vinod Koul, Matthias Brugger, dmaengine,
linux-arm-kernel, linux-mediatek
Cc: Rob Herring, linux-kernel, linux-renesas-soc, Prabhakar, Lad Prabhakar
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.
In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/dma/mediatek/mtk-cqdma.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c
index 41ef9f15d3d5..f8847c48ba03 100644
--- a/drivers/dma/mediatek/mtk-cqdma.c
+++ b/drivers/dma/mediatek/mtk-cqdma.c
@@ -751,7 +751,6 @@ static int mtk_cqdma_probe(struct platform_device *pdev)
struct mtk_cqdma_device *cqdma;
struct mtk_cqdma_vchan *vc;
struct dma_device *dd;
- struct resource *res;
int err;
u32 i;
@@ -824,13 +823,10 @@ static int mtk_cqdma_probe(struct platform_device *pdev)
return PTR_ERR(cqdma->pc[i]->base);
/* allocate IRQ resource */
- res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
- if (!res) {
- dev_err(&pdev->dev, "No irq resource for %s\n",
- dev_name(&pdev->dev));
- return -EINVAL;
- }
- cqdma->pc[i]->irq = res->start;
+ err = platform_get_irq(pdev, i);
+ if (err < 0)
+ return err;
+ cqdma->pc[i]->irq = err;
err = devm_request_irq(&pdev->dev, cqdma->pc[i]->irq,
mtk_cqdma_irq, 0, dev_name(&pdev->dev),
--
2.17.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread