* [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup
@ 2026-08-07 9:30 phucduc.bui
2026-08-07 9:30 ` [PATCH 2/2] thermal/drivers/brcmstb_thermal: Propagate errors " phucduc.bui
2026-08-07 9:44 ` [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO " Geert Uytterhoeven
0 siblings, 2 replies; 6+ messages in thread
From: phucduc.bui @ 2026-08-07 9:30 UTC (permalink / raw)
To: Markus Mayer, Broadcom internal kernel review list, rafael,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Florian Fainelli,
niklas.soderlund, Geert Uytterhoeven, Magnus Damm
Cc: linux-pm, linux-renesas-soc, linux-kernel, linux-arm-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
platform_get_irq_optional() returns -ENXIO when the optional IRQ is not
specified. Treat -ENXIO as a valid absence of an optional IRQ, while
propagating other errors.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/thermal/renesas/rcar_gen3_thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c
index 94804816e9e1..6204fb163ad7 100644
--- a/drivers/thermal/renesas/rcar_gen3_thermal.c
+++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
@@ -491,7 +491,7 @@ static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv,
for (i = 0; i < 2; i++) {
irq = platform_get_irq_optional(pdev, i);
- if (irq < 0)
+ if (irq < 0 && irq != -ENXIO)
return irq;
irqname = devm_kasprintf(dev, GFP_KERNEL, "%s:ch%d",
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] thermal/drivers/brcmstb_thermal: Propagate errors from optional IRQ lookup
2026-08-07 9:30 [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup phucduc.bui
@ 2026-08-07 9:30 ` phucduc.bui
2026-08-07 9:44 ` [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO " Geert Uytterhoeven
1 sibling, 0 replies; 6+ messages in thread
From: phucduc.bui @ 2026-08-07 9:30 UTC (permalink / raw)
To: Markus Mayer, Broadcom internal kernel review list, rafael,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Florian Fainelli,
niklas.soderlund, Geert Uytterhoeven, Magnus Damm
Cc: linux-pm, linux-renesas-soc, linux-kernel, linux-arm-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.
Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
probe without the IRQ.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/thermal/broadcom/brcmstb_thermal.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index a9ffa596f7c0..477d078ce326 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -350,7 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
priv->thermal = thermal;
irq = platform_get_irq_optional(pdev, 0);
- if (irq >= 0) {
+ if (irq < 0 && irq != -ENXIO)
+ return irq;
+ if (irq > 0) {
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
brcmstb_tmon_irq_thread,
IRQF_ONESHOT,
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup
2026-08-07 9:30 [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup phucduc.bui
2026-08-07 9:30 ` [PATCH 2/2] thermal/drivers/brcmstb_thermal: Propagate errors " phucduc.bui
@ 2026-08-07 9:44 ` Geert Uytterhoeven
2026-08-07 10:11 ` Bui Duc Phuc
1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2026-08-07 9:44 UTC (permalink / raw)
To: phucduc.bui
Cc: Markus Mayer, Broadcom internal kernel review list, rafael,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Florian Fainelli,
niklas.soderlund, Geert Uytterhoeven, Magnus Damm, linux-pm,
linux-renesas-soc, linux-kernel, linux-arm-kernel
Hi Phuc,
On Fri, 7 Aug 2026 at 11:31, <phucduc.bui@gmail.com> wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> platform_get_irq_optional() returns -ENXIO when the optional IRQ is not
> specified. Treat -ENXIO as a valid absence of an optional IRQ, while
> propagating other errors.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Thanks for your patch!
> --- a/drivers/thermal/renesas/rcar_gen3_thermal.c
> +++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
> @@ -491,7 +491,7 @@ static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv,
>
> for (i = 0; i < 2; i++) {
> irq = platform_get_irq_optional(pdev, i);
> - if (irq < 0)
> + if (irq < 0 && irq != -ENXIO)
> return irq;
>
So the code may continue using -ENXIO as an interrupt number (and fail)?
Why is this change needed at all?
The caller of rcar_gen3_thermal_request_irqs() knows how to handle
failures, as IRQs are optional.
> irqname = devm_kasprintf(dev, GFP_KERNEL, "%s:ch%d",
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] 6+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup
2026-08-07 9:44 ` [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO " Geert Uytterhoeven
@ 2026-08-07 10:11 ` Bui Duc Phuc
2026-08-07 10:36 ` Niklas Söderlund
0 siblings, 1 reply; 6+ messages in thread
From: Bui Duc Phuc @ 2026-08-07 10:11 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Markus Mayer, Broadcom internal kernel review list, rafael,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Florian Fainelli,
niklas.soderlund, Geert Uytterhoeven, Magnus Damm, linux-pm,
linux-renesas-soc, linux-kernel, linux-arm-kernel
Hi Geert,
Thank you for your feedback.
> > irq = platform_get_irq_optional(pdev, i);
> > - if (irq < 0)
> > + if (irq < 0 && irq != -ENXIO)
> > return irq;
> >
>
> So the code may continue using -ENXIO as an interrupt number (and fail)?
>
Yes, you are right. We should probably handle it similarly to:
https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_thermal.c#L422
and only assign the IRQ when the return value is positive:
if (ret > 0)
irq = ret;
> Why is this change needed at all?
> The caller of rcar_gen3_thermal_request_irqs() knows how to handle
> failures, as IRQs are optional.
>
Regarding the caller, I only found rcar_gen3_thermal_request_irqs()
being called here:
https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_gen3_thermal.c#L530
It does not appear to handle the error return there, so I don't think
the caller currently handles these failures explicitly.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup
2026-08-07 10:11 ` Bui Duc Phuc
@ 2026-08-07 10:36 ` Niklas Söderlund
2026-08-07 11:04 ` Bui Duc Phuc
0 siblings, 1 reply; 6+ messages in thread
From: Niklas Söderlund @ 2026-08-07 10:36 UTC (permalink / raw)
To: Bui Duc Phuc
Cc: Geert Uytterhoeven, Markus Mayer,
Broadcom internal kernel review list, rafael, Daniel Lezcano,
Zhang Rui, Lukasz Luba, Florian Fainelli, Geert Uytterhoeven,
Magnus Damm, linux-pm, linux-renesas-soc, linux-kernel,
linux-arm-kernel
On 2026-08-07 17:11:44 +0700, Bui Duc Phuc wrote:
> Hi Geert,
>
> Thank you for your feedback.
>
> > > irq = platform_get_irq_optional(pdev, i);
> > > - if (irq < 0)
> > > + if (irq < 0 && irq != -ENXIO)
> > > return irq;
> > >
> >
> > So the code may continue using -ENXIO as an interrupt number (and fail)?
> >
>
> Yes, you are right. We should probably handle it similarly to:
> https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_thermal.c#L422
> and only assign the IRQ when the return value is positive:
> if (ret > 0)
> irq = ret;
>
> > Why is this change needed at all?
> > The caller of rcar_gen3_thermal_request_irqs() knows how to handle
> > failures, as IRQs are optional.
> >
>
> Regarding the caller, I only found rcar_gen3_thermal_request_irqs()
> being called here:
> https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_gen3_thermal.c#L530
> It does not appear to handle the error return there, so I don't think
> the caller currently handles these failures explicitly.
Yes it does. If it can't get the optional interrupts the driver does not
support setting trip-points in hardware. No?
>
> Best regards,
> Phuc
--
Kind Regards,
Niklas Söderlund
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup
2026-08-07 10:36 ` Niklas Söderlund
@ 2026-08-07 11:04 ` Bui Duc Phuc
0 siblings, 0 replies; 6+ messages in thread
From: Bui Duc Phuc @ 2026-08-07 11:04 UTC (permalink / raw)
To: Niklas Söderlund
Cc: Geert Uytterhoeven, Markus Mayer,
Broadcom internal kernel review list, rafael, Daniel Lezcano,
Zhang Rui, Lukasz Luba, Florian Fainelli, Geert Uytterhoeven,
Magnus Damm, linux-pm, linux-renesas-soc, linux-kernel,
linux-arm-kernel
Hi Niklas Söderlund,
Thank you for your feedback .
> > Regarding the caller, I only found rcar_gen3_thermal_request_irqs()
> > being called here:
> > https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_gen3_thermal.c#L530
> > It does not appear to handle the error return there, so I don't think
> > the caller currently handles these failures explicitly.
>
> Yes it does. If it can't get the optional interrupts the driver does not
> support setting trip-points in hardware. No?
>
Yes, for -ENXIO, you're right.
The caller treats it as the absence of optional IRQs and disables
hardware trip-point support.
However, this also means that -EPROBE_DEFER, -EINVAL, and other errors
are currently treated the same way.
The caller does not distinguish these errors from -ENXIO, so the probe
continues instead of propagating the actual error.
I think the caller should distinguish -ENXIO from other errors:
keep the current behavior for -ENXIO, but propagate -EPROBE_DEFER,
-EINVAL, and other errors.
ret = rcar_gen3_thermal_request_irqs(priv, pdev);
if (ret == -ENXIO) {
priv->ops.set_trips = NULL;
} else if (ret) {
return ret;
}
Best regards,
Phuc
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-07 11:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 9:30 [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup phucduc.bui
2026-08-07 9:30 ` [PATCH 2/2] thermal/drivers/brcmstb_thermal: Propagate errors " phucduc.bui
2026-08-07 9:44 ` [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO " Geert Uytterhoeven
2026-08-07 10:11 ` Bui Duc Phuc
2026-08-07 10:36 ` Niklas Söderlund
2026-08-07 11:04 ` Bui Duc Phuc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox