Linux Power Management development
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: lukasz.luba@arm.com, rui.zhang@intel.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] thermal/core: Allocate the thermal class dynamically
Date: Fri, 8 May 2026 21:22:38 +0200	[thread overview]
Message-ID: <f00ef10a-9adb-4553-84cf-24995598ec1b@oss.qualcomm.com> (raw)
In-Reply-To: <CAJZ5v0gWgoZtuK6nZ+71QbdV96GXq8McQ=azcCuceph3XxBD4w@mail.gmail.com>

On 5/8/26 20:24, Rafael J. Wysocki wrote:
> On Fri, May 8, 2026 at 8:05 PM Daniel Lezcano
> <daniel.lezcano@oss.qualcomm.com> wrote:
>>
>> Use class_create() instead of a statically allocated struct class.
>>
>> This allows the thermal class to be managed through a dynamically
>> allocated class object and avoids keeping a static class instance
>> around.
> 
> I changed it the other way around during the last cycle, so is it
> really worth changing again?

Yes, I think it is because it does not reintroduce this change:

-       thermal_class = kzalloc_obj(*thermal_class);
-       if (!thermal_class) {
-               result = -ENOMEM;
+       result = class_register(&thermal_class);
+       if (result)
                 goto unregister_governors;
-       }

-       thermal_class->name = "thermal";
-       thermal_class->dev_release = thermal_release;
-
-       result = class_register(thermal_class);
-       if (result) {
-               kfree(thermal_class);
-               thermal_class = NULL;
-               goto unregister_governors;
-       }

It is replaced by thermal_create("thermal") which allocates and 
registers the class and we get rid of two global variables. But up to you.

  reply	other threads:[~2026-05-08 19:22 UTC|newest]

Thread overview: 10+ 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-08 18:05 ` [PATCH 2/4] thermal/core: Add dedicated release callback for thermal zones Daniel Lezcano
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 [this message]
2026-05-08 19:26       ` Rafael J. Wysocki
2026-05-08 19:28         ` Daniel Lezcano
2026-05-08 18:05 ` [PATCH 4/4] thermal/core: Use the thermal class pointer as init guard Daniel Lezcano
2026-05-08 18:10 ` [PATCH 0/4] thermal/core: Decouple release paths for tz and cdev 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=f00ef10a-9adb-4553-84cf-24995598ec1b@oss.qualcomm.com \
    --to=daniel.lezcano@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --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