[01/13] media: vsp1: Use platform_get_irq() to get the interrupt

Message ID 20211223173015.22251-2-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State Superseded, archived
Delegated to: Hans Verkuil
Headers
Series media: Use platform_get_irq*() variants to fetch IRQ's |

Commit Message

Prabhakar Mahadev Lad Dec. 23, 2021, 5:30 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>
---
 drivers/media/platform/vsp1/vsp1_drv.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
  

Comments

Laurent Pinchart Dec. 30, 2021, 12:06 a.m. UTC | #1
Hi Prabhakar,

Thank you for the patch.

On Thu, Dec 23, 2021 at 05:30:02PM +0000, 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>

Will you get this merged with the whole series, or should I take it in
my tree ?

> ---
>  drivers/media/platform/vsp1/vsp1_drv.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
> index c9044785b903..bbba91a65a0f 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -794,7 +794,6 @@ static int vsp1_probe(struct platform_device *pdev)
>  {
>  	struct vsp1_device *vsp1;
>  	struct device_node *fcp_node;
> -	struct resource *irq;
>  	unsigned int i;
>  	int ret;
>  
> @@ -813,14 +812,12 @@ static int vsp1_probe(struct platform_device *pdev)
>  	if (IS_ERR(vsp1->mmio))
>  		return PTR_ERR(vsp1->mmio);
>  
> -	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (!irq) {
> -		dev_err(&pdev->dev, "missing IRQ\n");
> -		return -EINVAL;
> -	}
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		return ret;

I'd use an int irq local variable, but it doesn't matter much. Up to
you.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  
> -	ret = devm_request_irq(&pdev->dev, irq->start, vsp1_irq_handler,
> -			      IRQF_SHARED, dev_name(&pdev->dev), vsp1);
> +	ret = devm_request_irq(&pdev->dev, ret, vsp1_irq_handler,
> +			       IRQF_SHARED, dev_name(&pdev->dev), vsp1);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to request IRQ\n");
>  		return ret;
  
Lad, Prabhakar Dec. 30, 2021, 12:32 p.m. UTC | #2
Hi Laurent,

Thank you for the review.

On Thu, Dec 30, 2021 at 12:06 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Prabhakar,
>
> Thank you for the patch.
>
> On Thu, Dec 23, 2021 at 05:30:02PM +0000, 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>
>
> Will you get this merged with the whole series, or should I take it in
> my tree ?
>
I intend to get this merged with the whole series, just to make sure
all of them are part of the same release. If there is an issue that's
OK too.

> > ---
> >  drivers/media/platform/vsp1/vsp1_drv.c | 13 +++++--------
> >  1 file changed, 5 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
> > index c9044785b903..bbba91a65a0f 100644
> > --- a/drivers/media/platform/vsp1/vsp1_drv.c
> > +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> > @@ -794,7 +794,6 @@ static int vsp1_probe(struct platform_device *pdev)
> >  {
> >       struct vsp1_device *vsp1;
> >       struct device_node *fcp_node;
> > -     struct resource *irq;
> >       unsigned int i;
> >       int ret;
> >
> > @@ -813,14 +812,12 @@ static int vsp1_probe(struct platform_device *pdev)
> >       if (IS_ERR(vsp1->mmio))
> >               return PTR_ERR(vsp1->mmio);
> >
> > -     irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > -     if (!irq) {
> > -             dev_err(&pdev->dev, "missing IRQ\n");
> > -             return -EINVAL;
> > -     }
> > +     ret = platform_get_irq(pdev, 0);
> > +     if (ret < 0)
> > +             return ret;
>
> I'd use an int irq local variable, but it doesn't matter much. Up to
> you.
>
Anyway I plan to post a v2 for this series fixing a couple of comments
from Andy. Will use a local variable irq then and include your RB tag.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> >
> > -     ret = devm_request_irq(&pdev->dev, irq->start, vsp1_irq_handler,
> > -                           IRQF_SHARED, dev_name(&pdev->dev), vsp1);
> > +     ret = devm_request_irq(&pdev->dev, ret, vsp1_irq_handler,
> > +                            IRQF_SHARED, dev_name(&pdev->dev), vsp1);
> >       if (ret < 0) {
> >               dev_err(&pdev->dev, "failed to request IRQ\n");
> >               return ret;
>
Cheers,
Prabhakar
  

Patch

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index c9044785b903..bbba91a65a0f 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -794,7 +794,6 @@  static int vsp1_probe(struct platform_device *pdev)
 {
 	struct vsp1_device *vsp1;
 	struct device_node *fcp_node;
-	struct resource *irq;
 	unsigned int i;
 	int ret;
 
@@ -813,14 +812,12 @@  static int vsp1_probe(struct platform_device *pdev)
 	if (IS_ERR(vsp1->mmio))
 		return PTR_ERR(vsp1->mmio);
 
-	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!irq) {
-		dev_err(&pdev->dev, "missing IRQ\n");
-		return -EINVAL;
-	}
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
 
-	ret = devm_request_irq(&pdev->dev, irq->start, vsp1_irq_handler,
-			      IRQF_SHARED, dev_name(&pdev->dev), vsp1);
+	ret = devm_request_irq(&pdev->dev, ret, vsp1_irq_handler,
+			       IRQF_SHARED, dev_name(&pdev->dev), vsp1);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to request IRQ\n");
 		return ret;