The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] thermal: rcar: handle runtime resume failures during probe
@ 2026-11-29 13:02 Jiawen Liu
  2026-11-30  6:46 ` Biju Das
  2026-11-30 10:03 ` Geert Uytterhoeven
  0 siblings, 2 replies; 4+ messages in thread
From: Jiawen Liu @ 2026-11-29 13:02 UTC (permalink / raw)
  To: Niklas Söderlund, Rafael J. Wysocki, Daniel Lezcano,
	Geert Uytterhoeven, Magnus Damm
  Cc: Zhang Rui, Lukasz Luba, linux-renesas-soc, linux-pm, linux-kernel

rcar_thermal_probe() ignores the synchronous runtime resume result and
continues to sensor MMIO and thermal-zone registration after the PM core
reports failure.

Use pm_runtime_resume_and_get(), which retains a usage reference only
after a successful resume. On failure, disable runtime PM and return the
original error before hardware initialization.

Fixes: 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/renesas/rcar_thermal.c b/drivers/thermal/renesas/rcar_thermal.c
index af6d09a75bb61..c6535b9cdd0fe 100644
--- a/drivers/thermal/renesas/rcar_thermal.c
+++ b/drivers/thermal/renesas/rcar_thermal.c
@@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	common->dev = dev;
 
 	pm_runtime_enable(dev);
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		pm_runtime_disable(dev);
+		return ret;
+	}
 
 	for (i = 0; i < chip->nirqs; i++) {
 		int irq;
-- 
2.34.1


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

* RE: [PATCH] thermal: rcar: handle runtime resume failures during probe
  2026-11-29 13:02 [PATCH] thermal: rcar: handle runtime resume failures during probe Jiawen Liu
@ 2026-11-30  6:46 ` Biju Das
  2026-11-30 15:38   ` niklas.soderlund
  2026-11-30 10:03 ` Geert Uytterhoeven
  1 sibling, 1 reply; 4+ messages in thread
From: Biju Das @ 2026-11-30  6:46 UTC (permalink / raw)
  To: Jiawen Liu, niklas.soderlund, Rafael J. Wysocki, Daniel Lezcano,
	Geert Uytterhoeven, magnus.damm
  Cc: Zhang Rui, Lukasz Luba, linux-renesas-soc@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org

Hi Jiawen Liu,

Thanks for the patch.

> -----Original Message-----
> From: Jiawen Liu <1298662399@qq.com>
> Sent: 29 November 2026 13:03
> Subject: [PATCH] thermal: rcar: handle runtime resume failures during probe
> 
> rcar_thermal_probe() ignores the synchronous runtime resume result and continues to sensor MMIO and
> thermal-zone registration after the PM core reports failure.
> 
> Use pm_runtime_resume_and_get(), which retains a usage reference only after a successful resume. On
> failure, disable runtime PM and return the original error before hardware initialization.
> 
> Fixes: 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
> Signed-off-by: Jiawen Liu <1298662399@qq.com>
> ---
>  drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/renesas/rcar_thermal.c b/drivers/thermal/renesas/rcar_thermal.c
> index af6d09a75bb61..c6535b9cdd0fe 100644
> --- a/drivers/thermal/renesas/rcar_thermal.c
> +++ b/drivers/thermal/renesas/rcar_thermal.c
> @@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  	common->dev = dev;
> 
>  	pm_runtime_enable(dev);
> -	pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret) {
> +		pm_runtime_disable(dev);

If you use devm_pm_runtime_enable() then you can drop the 
above.

Cheers,
Biju

> +		return ret;
> +	}
> 
>  	for (i = 0; i < chip->nirqs; i++) {
>  		int irq;
> --
> 2.34.1
> 


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

* Re: [PATCH] thermal: rcar: handle runtime resume failures during probe
  2026-11-29 13:02 [PATCH] thermal: rcar: handle runtime resume failures during probe Jiawen Liu
  2026-11-30  6:46 ` Biju Das
@ 2026-11-30 10:03 ` Geert Uytterhoeven
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-11-30 10:03 UTC (permalink / raw)
  To: Jiawen Liu, Niklas Söderlund, Rafael J . Wysocki,
	Daniel Lezcano, Magnus Damm
  Cc: Zhang Rui, Lukasz Luba, linux-renesas-soc, linux-pm, linux-kernel

Hi Jiawen,

Thanks for your patch!

On Sun, Nov 29, 2026, at 14:02, Jiawen Liu wrote:
> rcar_thermal_probe() ignores the synchronous runtime resume result and
> continues to sensor MMIO and thermal-zone registration after the PM core
> reports failure.

This sounds like the failure does happen, followed by Bad Things.
In practice, pm_runtime_get_sync() cannot fail on R-Car systems.
So please write "If it fails...".

>
> Use pm_runtime_resume_and_get(), which retains a usage reference only
> after a successful resume. On failure, disable runtime PM and return the
> original error before hardware initialization.
>
> Fixes: 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
> Signed-off-by: Jiawen Liu <1298662399@qq.com>
> ---
>  drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/renesas/rcar_thermal.c 
> b/drivers/thermal/renesas/rcar_thermal.c
> index af6d09a75bb61..c6535b9cdd0fe 100644
> --- a/drivers/thermal/renesas/rcar_thermal.c
> +++ b/drivers/thermal/renesas/rcar_thermal.c
> @@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct 
> platform_device *pdev)
>  	common->dev = dev;
> 
>  	pm_runtime_enable(dev);
> -	pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret) {
> +		pm_runtime_disable(dev);
> +		return ret;
> +	}
> 
>  	for (i = 0; i < chip->nirqs; i++) {
>  		int irq;

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] 4+ messages in thread

* Re: [PATCH] thermal: rcar: handle runtime resume failures during probe
  2026-11-30  6:46 ` Biju Das
@ 2026-11-30 15:38   ` niklas.soderlund
  0 siblings, 0 replies; 4+ messages in thread
From: niklas.soderlund @ 2026-11-30 15:38 UTC (permalink / raw)
  To: Biju Das
  Cc: Jiawen Liu, Rafael J. Wysocki, Daniel Lezcano, Geert Uytterhoeven,
	magnus.damm, Zhang Rui, Lukasz Luba,
	linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org

Hello,

On 2026-11-30 06:46:16 +0000, Biju Das wrote:
> Hi Jiawen Liu,
> 
> Thanks for the patch.
> 
> > -----Original Message-----
> > From: Jiawen Liu <1298662399@qq.com>
> > Sent: 29 November 2026 13:03
> > Subject: [PATCH] thermal: rcar: handle runtime resume failures during probe
> > 
> > rcar_thermal_probe() ignores the synchronous runtime resume result and continues to sensor MMIO and
> > thermal-zone registration after the PM core reports failure.
> > 
> > Use pm_runtime_resume_and_get(), which retains a usage reference only after a successful resume. On
> > failure, disable runtime PM and return the original error before hardware initialization.
> > 
> > Fixes: 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
> > Signed-off-by: Jiawen Liu <1298662399@qq.com>
> > ---
> >  drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/thermal/renesas/rcar_thermal.c b/drivers/thermal/renesas/rcar_thermal.c
> > index af6d09a75bb61..c6535b9cdd0fe 100644
> > --- a/drivers/thermal/renesas/rcar_thermal.c
> > +++ b/drivers/thermal/renesas/rcar_thermal.c
> > @@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> >  	common->dev = dev;
> > 
> >  	pm_runtime_enable(dev);
> > -	pm_runtime_get_sync(dev);
> > +	ret = pm_runtime_resume_and_get(dev);
> > +	if (ret) {
> > +		pm_runtime_disable(dev);
> 
> If you use devm_pm_runtime_enable() then you can drop the 
> above.

I think I would prefer that, and the commit message update suggested by 
Geert.

> 
> Cheers,
> Biju
> 
> > +		return ret;
> > +	}
> > 
> >  	for (i = 0; i < chip->nirqs; i++) {
> >  		int irq;
> > --
> > 2.34.1
> > 
> 

-- 
Kind Regards,
Niklas Söderlund

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

end of thread, other threads:[~2026-11-30 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 13:02 [PATCH] thermal: rcar: handle runtime resume failures during probe Jiawen Liu
2026-11-30  6:46 ` Biju Das
2026-11-30 15:38   ` niklas.soderlund
2026-11-30 10:03 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox