diff mbox series

watchdog: s3c2410: Use platform_get_irq() to get the interrupt

Message ID 20211216183639.7710-1-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State New
Headers show
Series watchdog: s3c2410: Use platform_get_irq() to get the interrupt | expand

Commit Message

Lad Prabhakar Dec. 16, 2021, 6:36 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 bypassed the hierarchical setup and messed 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/watchdog/s3c2410_wdt.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Guenter Roeck Dec. 16, 2021, 7:01 p.m. UTC | #1
On 12/16/21 10:36 AM, 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 bypassed the hierarchical setup and messed 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/watchdog/s3c2410_wdt.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 2395f353e52d..f5aced344b7b 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -513,9 +513,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct s3c2410_wdt *wdt;
> -	struct resource *wdt_irq;
>   	unsigned int wtcon;
>   	int started = 0;
> +	int wdt_irq;
>   	int ret;
>   
>   	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
> @@ -536,10 +536,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>   		}
>   	}
>   
> -	wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (wdt_irq == NULL) {
> -		dev_err(dev, "no irq resource specified\n");
> -		ret = -ENOENT;
> +	wdt_irq = platform_get_irq(pdev, 0);
> +	if (wdt_irq < 0) {
> +		ret = wdt_irq;
>   		goto err;

All those "goto err;" statements in this function are pointless since they
just return ret. Since this is the first of those goto statements, please
replace it with "return wdt_irq;".

Thanks,
Guenter

>   	}
>   
> @@ -592,8 +591,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>   			dev_info(dev, "default timer value is out of range, cannot start\n");
>   	}
>   
> -	ret = devm_request_irq(dev, wdt_irq->start, s3c2410wdt_irq, 0,
> -				pdev->name, pdev);
> +	ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0,
> +			       pdev->name, pdev);
>   	if (ret != 0) {
>   		dev_err(dev, "failed to install irq (%d)\n", ret);
>   		goto err_cpufreq;
>
Lad, Prabhakar Dec. 16, 2021, 9:42 p.m. UTC | #2
Hi Guenter,

Thank you for the review.

On Thu, Dec 16, 2021 at 7:01 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On 12/16/21 10:36 AM, 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 bypassed the hierarchical setup and messed 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/watchdog/s3c2410_wdt.c | 13 ++++++-------
> >   1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> > index 2395f353e52d..f5aced344b7b 100644
> > --- a/drivers/watchdog/s3c2410_wdt.c
> > +++ b/drivers/watchdog/s3c2410_wdt.c
> > @@ -513,9 +513,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> >   {
> >       struct device *dev = &pdev->dev;
> >       struct s3c2410_wdt *wdt;
> > -     struct resource *wdt_irq;
> >       unsigned int wtcon;
> >       int started = 0;
> > +     int wdt_irq;
> >       int ret;
> >
> >       wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
> > @@ -536,10 +536,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> >               }
> >       }
> >
> > -     wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > -     if (wdt_irq == NULL) {
> > -             dev_err(dev, "no irq resource specified\n");
> > -             ret = -ENOENT;
> > +     wdt_irq = platform_get_irq(pdev, 0);
> > +     if (wdt_irq < 0) {
> > +             ret = wdt_irq;
> >               goto err;
>
> All those "goto err;" statements in this function are pointless since they
> just return ret. Since this is the first of those goto statements, please
> replace it with "return wdt_irq;".
>
Sure will do and post a v2.

> Thanks,
> Guenter
>
> >       }
> >
> > @@ -592,8 +591,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> >                       dev_info(dev, "default timer value is out of range, cannot start\n");
> >       }
> >
> > -     ret = devm_request_irq(dev, wdt_irq->start, s3c2410wdt_irq, 0,
> > -                             pdev->name, pdev);
> > +     ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0,
> > +                            pdev->name, pdev);
> >       if (ret != 0) {
> >               dev_err(dev, "failed to install irq (%d)\n", ret);
> >               goto err_cpufreq;
> >
>
Cheers,
Prabhakar
diff mbox series

Patch

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 2395f353e52d..f5aced344b7b 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -513,9 +513,9 @@  static int s3c2410wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct s3c2410_wdt *wdt;
-	struct resource *wdt_irq;
 	unsigned int wtcon;
 	int started = 0;
+	int wdt_irq;
 	int ret;
 
 	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
@@ -536,10 +536,9 @@  static int s3c2410wdt_probe(struct platform_device *pdev)
 		}
 	}
 
-	wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (wdt_irq == NULL) {
-		dev_err(dev, "no irq resource specified\n");
-		ret = -ENOENT;
+	wdt_irq = platform_get_irq(pdev, 0);
+	if (wdt_irq < 0) {
+		ret = wdt_irq;
 		goto err;
 	}
 
@@ -592,8 +591,8 @@  static int s3c2410wdt_probe(struct platform_device *pdev)
 			dev_info(dev, "default timer value is out of range, cannot start\n");
 	}
 
-	ret = devm_request_irq(dev, wdt_irq->start, s3c2410wdt_irq, 0,
-				pdev->name, pdev);
+	ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0,
+			       pdev->name, pdev);
 	if (ret != 0) {
 		dev_err(dev, "failed to install irq (%d)\n", ret);
 		goto err_cpufreq;