diff mbox series

[v2,2/3] dmaengine: mediatek: mtk-hsdma: Use platform_get_irq() to get the interrupt

Message ID 20220104163519.21929-3-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State New, archived
Headers show
Series dmaengine: Use platform_get_irq*() variants to fetch IRQ's | expand

Commit Message

Lad Prabhakar Jan. 4, 2022, 4:35 p.m. UTC
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>
---
v1->v2
* No change
---
 drivers/dma/mediatek/mtk-hsdma.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Vinod Koul Jan. 6, 2022, 5:27 a.m. UTC | #1
On 04-01-22, 16:35, Lad Prabhakar 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().
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2
> * No change
> ---
>  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);

why not platform_get_irq_optional() here and 3rd patch ?

> +	if (err < 0)
> +		return err;
> +	hsdma->irq = err;
>  
>  	refcount_set(&hsdma->pc_refcnt, 0);
>  	spin_lock_init(&hsdma->lock);
> -- 
> 2.17.1
Lad, Prabhakar Jan. 6, 2022, 8:44 a.m. UTC | #2
Hi Vinod,

Thank you for the review.

On Thu, Jan 6, 2022 at 5:27 AM Vinod Koul <vkoul@kernel.org> wrote:
>
> On 04-01-22, 16:35, Lad Prabhakar 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().
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > v1->v2
> > * No change
> > ---
> >  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);
>
> why not platform_get_irq_optional() here and 3rd patch ?
>
For patches #2 and #3 the driver expects the IRQ to be present
strictly, that is the reason platform_get_irq_optional() isn't used so
that the behavior of the driver is unchanged with this patch.

Cheers,
Prabhakar

> > +     if (err < 0)
> > +             return err;
> > +     hsdma->irq = err;
> >
> >       refcount_set(&hsdma->pc_refcnt, 0);
> >       spin_lock_init(&hsdma->lock);
> > --
> > 2.17.1
>
> --
> ~Vinod
diff mbox series

Patch

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);