linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] watchdog: s3c2410: Use platform_get_irq() to get the interrupt
@ 2021-12-16 21:47 Lad Prabhakar
  2021-12-17  0:26 ` Guenter Roeck
  2021-12-17  9:35 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: Lad Prabhakar @ 2021-12-16 21:47 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Krzysztof Kozlowski,
	linux-watchdog, linux-arm-kernel, linux-samsung-soc
  Cc: linux-kernel, Prabhakar, Rob Herring, 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 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>
---
v1->v2
* Dropped goto and directly returned on error
---
 drivers/watchdog/s3c2410_wdt.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 2395f353e52d..d92bc1c24182 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,12 +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;
-		goto err;
-	}
+	wdt_irq = platform_get_irq(pdev, 0);
+	if (wdt_irq < 0)
+		return wdt_irq;
 
 	/* get the memory region for the watchdog timer */
 	wdt->reg_base = devm_platform_ioremap_resource(pdev, 0);
@@ -592,8 +589,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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] watchdog: s3c2410: Use platform_get_irq() to get the interrupt
  2021-12-16 21:47 [PATCH v2] watchdog: s3c2410: Use platform_get_irq() to get the interrupt Lad Prabhakar
@ 2021-12-17  0:26 ` Guenter Roeck
  2021-12-17  9:35 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-12-17  0:26 UTC (permalink / raw)
  To: Lad Prabhakar, Wim Van Sebroeck, Krzysztof Kozlowski,
	linux-watchdog, linux-arm-kernel, linux-samsung-soc
  Cc: linux-kernel, Prabhakar, Rob Herring

On 12/16/21 1:47 PM, 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>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> v1->v2
> * Dropped goto and directly returned on error
> ---
>   drivers/watchdog/s3c2410_wdt.c | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 2395f353e52d..d92bc1c24182 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,12 +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;
> -		goto err;
> -	}
> +	wdt_irq = platform_get_irq(pdev, 0);
> +	if (wdt_irq < 0)
> +		return wdt_irq;
>   
>   	/* get the memory region for the watchdog timer */
>   	wdt->reg_base = devm_platform_ioremap_resource(pdev, 0);
> @@ -592,8 +589,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;
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] watchdog: s3c2410: Use platform_get_irq() to get the interrupt
  2021-12-16 21:47 [PATCH v2] watchdog: s3c2410: Use platform_get_irq() to get the interrupt Lad Prabhakar
  2021-12-17  0:26 ` Guenter Roeck
@ 2021-12-17  9:35 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2021-12-17  9:35 UTC (permalink / raw)
  To: Lad Prabhakar, Wim Van Sebroeck, Guenter Roeck, linux-watchdog,
	linux-arm-kernel, linux-samsung-soc
  Cc: linux-kernel, Prabhakar, Rob Herring

On 16/12/2021 22:47, 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>
> ---
> v1->v2
> * Dropped goto and directly returned on error
> ---
>  drivers/watchdog/s3c2410_wdt.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-17  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 21:47 [PATCH v2] watchdog: s3c2410: Use platform_get_irq() to get the interrupt Lad Prabhakar
2021-12-17  0:26 ` Guenter Roeck
2021-12-17  9:35 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).