The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, rafael@kernel.org
Subject: Re: [PATCH 4/4] thermal/core: Use the thermal class pointer as init guard
Date: Wed, 13 May 2026 16:03:26 +0100	[thread overview]
Message-ID: <bf7b28aa-d7a2-4d21-ad76-c9855effae43@arm.com> (raw)
In-Reply-To: <20260508180511.1306659-5-daniel.lezcano@oss.qualcomm.com>



On 5/8/26 19:05, Daniel Lezcano wrote:
> The thermal class is now dynamically allocated and stored as a
> pointer.
> 
> Use the thermal_class pointer itself to check whether the thermal
> class has been created instead of keeping a separate
> thermal_class_unavailable flag.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> ---
>   drivers/thermal/thermal_core.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 748ab76823a3..81f6bbaded65 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -950,7 +950,6 @@ static void thermal_unbind_cdev_from_trip(struct thermal_zone_device *tz,
>   }
>   
>   static struct class *thermal_class;
> -static bool thermal_class_unavailable __ro_after_init = true;
>   
>   static inline
>   void print_bind_err_msg(struct thermal_zone_device *tz,
> @@ -1053,7 +1052,7 @@ __thermal_cooling_device_register(struct device_node *np,
>   	    !ops->set_cur_state)
>   		return ERR_PTR(-EINVAL);
>   
> -	if (thermal_class_unavailable)
> +	if (!thermal_class)
>   		return ERR_PTR(-ENODEV);
>   
>   	cdev = kzalloc_obj(*cdev);
> @@ -1536,7 +1535,7 @@ thermal_zone_device_register_with_trips(const char *type,
>   	if (polling_delay && passive_delay > polling_delay)
>   		return ERR_PTR(-EINVAL);
>   
> -	if (thermal_class_unavailable)
> +	if (!thermal_class)
>   		return ERR_PTR(-ENODEV);
>   
>   	tz = kzalloc_flex(*tz, trips, num_trips);
> @@ -1834,7 +1833,7 @@ static void __thermal_pm_prepare(void)
>   
>   void thermal_pm_prepare(void)
>   {
> -	if (thermal_class_unavailable)
> +	if (!thermal_class)
>   		return;
>   
>   	__thermal_pm_prepare();
> @@ -1865,7 +1864,7 @@ void thermal_pm_complete(void)
>   {
>   	struct thermal_zone_device *tz;
>   
> -	if (thermal_class_unavailable)
> +	if (!thermal_class)
>   		return;
>   
>   	guard(mutex)(&thermal_list_lock);
> @@ -1902,8 +1901,6 @@ static int __init thermal_init(void)
>   		goto unregister_governors;
>   	}
>   
> -	thermal_class_unavailable = false;
> -
>   	return 0;
>   
>   unregister_governors:


Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

  reply	other threads:[~2026-05-13 15:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 18:05 [PATCH 0/4] thermal/core: Decouple release paths for tz and cdev Daniel Lezcano
2026-05-08 18:05 ` [PATCH 1/4] thermal/core: Add dedicated release callback for cooling devices Daniel Lezcano
2026-05-13 15:02   ` Lukasz Luba
2026-05-08 18:05 ` [PATCH 2/4] thermal/core: Add dedicated release callback for thermal zones Daniel Lezcano
2026-05-13 15:02   ` Lukasz Luba
2026-05-08 18:05 ` [PATCH 3/4] thermal/core: Allocate the thermal class dynamically Daniel Lezcano
2026-05-08 18:24   ` Rafael J. Wysocki
2026-05-08 19:22     ` Daniel Lezcano
2026-05-08 19:26       ` Rafael J. Wysocki
2026-05-08 19:28         ` Daniel Lezcano
2026-05-13 15:03   ` Lukasz Luba
2026-05-08 18:05 ` [PATCH 4/4] thermal/core: Use the thermal class pointer as init guard Daniel Lezcano
2026-05-13 15:03   ` Lukasz Luba [this message]
2026-05-08 18:10 ` [PATCH 0/4] thermal/core: Decouple release paths for tz and cdev Daniel Lezcano
2026-05-13 14:22   ` Daniel Lezcano
2026-05-13 15:06     ` Rafael J. Wysocki
2026-05-13 15:45       ` Lukasz Luba
2026-05-13 15:48         ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf7b28aa-d7a2-4d21-ad76-c9855effae43@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox