linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt
@ 2022-01-10 14:40 Lad Prabhakar
  2022-01-12  8:35 ` Geert Uytterhoeven
  2022-03-09 11:59 ` Lad, Prabhakar
  0 siblings, 2 replies; 5+ messages in thread
From: Lad Prabhakar @ 2022-01-10 14:40 UTC (permalink / raw)
  To: Niklas Söderlund, Rafael J. Wysocki, Daniel Lezcano,
	Amit Kucheria, Zhang Rui
  Cc: Rob Herring, Andy Shevchenko, Prabhakar, Lad Prabhakar,
	linux-renesas-soc, linux-pm, linux-kernel

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().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v3->v4:
* Updated check as suggested by Andy

v2->v3:
* Fixed review comment pointed by Andy

v1->v2
* Simplified checking error code
* Break loop earlier if no interrupts are seen

v1: https://lkml.org/lkml/2021/12/18/163
---
 drivers/thermal/rcar_thermal.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index b49f04daaf47..1d729ed4d685 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -445,7 +445,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	struct rcar_thermal_common *common;
 	struct rcar_thermal_priv *priv;
 	struct device *dev = &pdev->dev;
-	struct resource *res, *irq;
+	struct resource *res;
 	const struct rcar_thermal_chip *chip = of_device_get_match_data(dev);
 	int mres = 0;
 	int i;
@@ -467,9 +467,16 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	pm_runtime_get_sync(dev);
 
 	for (i = 0; i < chip->nirqs; i++) {
-		irq = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-		if (!irq)
-			continue;
+		int irq;
+
+		ret = platform_get_irq_optional(pdev, i);
+		if (ret < 0 && ret != -ENXIO)
+			goto error_unregister;
+		if (ret > 0)
+			irq = ret;
+		else
+			break;
+
 		if (!common->base) {
 			/*
 			 * platform has IRQ support.
@@ -487,7 +494,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 			idle = 0; /* polling delay is not needed */
 		}
 
-		ret = devm_request_irq(dev, irq->start, rcar_thermal_irq,
+		ret = devm_request_irq(dev, irq, rcar_thermal_irq,
 				       IRQF_SHARED, dev_name(dev), common);
 		if (ret) {
 			dev_err(dev, "irq request failed\n ");
-- 
2.17.1


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

* Re: [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt
  2022-01-10 14:40 [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
@ 2022-01-12  8:35 ` Geert Uytterhoeven
  2022-03-09 11:59 ` Lad, Prabhakar
  1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2022-01-12  8:35 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Niklas Söderlund, Rafael J. Wysocki, Daniel Lezcano,
	Amit Kucheria, Zhang Rui, Rob Herring, Andy Shevchenko,
	Prabhakar, Linux-Renesas, Linux PM list,
	Linux Kernel Mailing List

On Tue, Jan 11, 2022 at 4:24 AM 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().
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt
  2022-01-10 14:40 [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
  2022-01-12  8:35 ` Geert Uytterhoeven
@ 2022-03-09 11:59 ` Lad, Prabhakar
  2022-03-09 12:40   ` Daniel Lezcano
  1 sibling, 1 reply; 5+ messages in thread
From: Lad, Prabhakar @ 2022-03-09 11:59 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Lad Prabhakar, Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria,
	Zhang Rui, Rob Herring, Andy Shevchenko, Linux-Renesas,
	Linux PM list, LKML

Hi Niklas,

On Mon, Jan 10, 2022 at 2:40 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().
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v3->v4:
> * Updated check as suggested by Andy
>
> v2->v3:
> * Fixed review comment pointed by Andy
>
> v1->v2
> * Simplified checking error code
> * Break loop earlier if no interrupts are seen
>
> v1: https://lkml.org/lkml/2021/12/18/163
> ---
>  drivers/thermal/rcar_thermal.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
This patch is not in -next yet. In which release v5.18/19 do you plan
to merge this in?

Cheers,
Prabhakar

> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index b49f04daaf47..1d729ed4d685 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -445,7 +445,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>         struct rcar_thermal_common *common;
>         struct rcar_thermal_priv *priv;
>         struct device *dev = &pdev->dev;
> -       struct resource *res, *irq;
> +       struct resource *res;
>         const struct rcar_thermal_chip *chip = of_device_get_match_data(dev);
>         int mres = 0;
>         int i;
> @@ -467,9 +467,16 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>         pm_runtime_get_sync(dev);
>
>         for (i = 0; i < chip->nirqs; i++) {
> -               irq = platform_get_resource(pdev, IORESOURCE_IRQ, i);
> -               if (!irq)
> -                       continue;
> +               int irq;
> +
> +               ret = platform_get_irq_optional(pdev, i);
> +               if (ret < 0 && ret != -ENXIO)
> +                       goto error_unregister;
> +               if (ret > 0)
> +                       irq = ret;
> +               else
> +                       break;
> +
>                 if (!common->base) {
>                         /*
>                          * platform has IRQ support.
> @@ -487,7 +494,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>                         idle = 0; /* polling delay is not needed */
>                 }
>
> -               ret = devm_request_irq(dev, irq->start, rcar_thermal_irq,
> +               ret = devm_request_irq(dev, irq, rcar_thermal_irq,
>                                        IRQF_SHARED, dev_name(dev), common);
>                 if (ret) {
>                         dev_err(dev, "irq request failed\n ");
> --
> 2.17.1
>

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

* Re: [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt
  2022-03-09 11:59 ` Lad, Prabhakar
@ 2022-03-09 12:40   ` Daniel Lezcano
  2022-03-09 12:47     ` Lad, Prabhakar
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2022-03-09 12:40 UTC (permalink / raw)
  To: Lad, Prabhakar, Niklas Söderlund
  Cc: Lad Prabhakar, Rafael J. Wysocki, Amit Kucheria, Zhang Rui,
	Rob Herring, Andy Shevchenko, Linux-Renesas, Linux PM list, LKML

On 09/03/2022 12:59, Lad, Prabhakar wrote:

[ ... ]

>> ---
>>   drivers/thermal/rcar_thermal.c | 17 ++++++++++++-----
>>   1 file changed, 12 insertions(+), 5 deletions(-)
>>
> This patch is not in -next yet. In which release v5.18/19 do you plan
> to merge this in?
Right, I missed it, I'll try to catch it up for v5.18-rc1, may be with a 
second PR.

It is in the linux-next branch now and will land in linux-next tree

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt
  2022-03-09 12:40   ` Daniel Lezcano
@ 2022-03-09 12:47     ` Lad, Prabhakar
  0 siblings, 0 replies; 5+ messages in thread
From: Lad, Prabhakar @ 2022-03-09 12:47 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Niklas Söderlund, Lad Prabhakar, Rafael J. Wysocki,
	Amit Kucheria, Zhang Rui, Rob Herring, Andy Shevchenko,
	Linux-Renesas, Linux PM list, LKML

On Wed, Mar 9, 2022 at 12:40 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 09/03/2022 12:59, Lad, Prabhakar wrote:
>
> [ ... ]
>
> >> ---
> >>   drivers/thermal/rcar_thermal.c | 17 ++++++++++++-----
> >>   1 file changed, 12 insertions(+), 5 deletions(-)
> >>
> > This patch is not in -next yet. In which release v5.18/19 do you plan
> > to merge this in?
> Right, I missed it, I'll try to catch it up for v5.18-rc1, may be with a
> second PR.
>
should be OK.

> It is in the linux-next branch now and will land in linux-next tree
>
Thanks.

Cheers,
Prabhakar

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

end of thread, other threads:[~2022-03-09 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 14:40 [PATCH v4] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
2022-01-12  8:35 ` Geert Uytterhoeven
2022-03-09 11:59 ` Lad, Prabhakar
2022-03-09 12:40   ` Daniel Lezcano
2022-03-09 12:47     ` Lad, Prabhakar

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