* [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes
@ 2026-08-24 17:50 Rafael J. Wysocki
2026-08-24 17:52 ` [PATCH v1 1/2] Revert "thermal/core: Use the thermal class pointer as init guard" Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-08-24 17:50 UTC (permalink / raw)
To: Linux PM
Cc: Greg Kroah-Hartman, Danilo Krummrich, Daniel Lezcano, LKML,
Lukasz Luba, Linux Driver Core Development
Hi All,
Two recent thermal core commits restored the usage of class_create()
into the thermal core as a cleanup matter, but that goes against the
driver core plans to get rid of that function.
Revert these two commits and let class_create() be eliminated.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/2] Revert "thermal/core: Use the thermal class pointer as init guard"
2026-08-24 17:50 [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Rafael J. Wysocki
@ 2026-08-24 17:52 ` Rafael J. Wysocki
2026-08-24 17:53 ` [PATCH v1 2/2] Revert "thermal/core: Allocate the thermal class dynamically" Rafael J. Wysocki
2026-08-25 5:55 ` [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-08-24 17:52 UTC (permalink / raw)
To: Linux PM
Cc: Greg Kroah-Hartman, Danilo Krummrich, Daniel Lezcano, LKML,
Lukasz Luba, Linux Driver Core Development
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
This reverts commit 499274d078d0 ("thermal/core: Use the thermal class
pointer as init guard") because it depends on another commit that needs
to be reverted.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 28a20d4b475c..2d9d8740491f 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -890,6 +890,7 @@ static void thermal_unbind_cdev_from_trip(struct thermal_zone_device *tz,
}
static struct class *thermal_class __ro_after_init;
+static bool thermal_class_unavailable __ro_after_init = true;
static inline
void print_bind_err_msg(struct thermal_zone_device *tz,
@@ -973,7 +974,7 @@ thermal_cooling_device_alloc(const char *type, const struct thermal_cooling_devi
!ops->set_cur_state)
return ERR_PTR(-EINVAL);
- if (!thermal_class)
+ if (thermal_class_unavailable)
return ERR_PTR(-ENODEV);
cdev = kzalloc_obj(*cdev);
@@ -1447,7 +1448,7 @@ thermal_zone_device_register_with_trips(const char *type,
if (polling_delay && passive_delay > polling_delay)
return ERR_PTR(-EINVAL);
- if (!thermal_class)
+ if (thermal_class_unavailable)
return ERR_PTR(-ENODEV);
tz = kzalloc_flex(*tz, trips, num_trips);
@@ -1745,7 +1746,7 @@ static void __thermal_pm_prepare(void)
void thermal_pm_prepare(void)
{
- if (!thermal_class)
+ if (thermal_class_unavailable)
return;
__thermal_pm_prepare();
@@ -1776,7 +1777,7 @@ void thermal_pm_complete(void)
{
struct thermal_zone_device *tz;
- if (!thermal_class)
+ if (thermal_class_unavailable)
return;
guard(mutex)(&thermal_list_lock);
@@ -1815,6 +1816,8 @@ static int __init thermal_init(void)
}
thermal_class = tc;
+ thermal_class_unavailable = false;
+
return 0;
unregister_governors:
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] Revert "thermal/core: Allocate the thermal class dynamically"
2026-08-24 17:50 [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Rafael J. Wysocki
2026-08-24 17:52 ` [PATCH v1 1/2] Revert "thermal/core: Use the thermal class pointer as init guard" Rafael J. Wysocki
@ 2026-08-24 17:53 ` Rafael J. Wysocki
2026-08-25 5:55 ` [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-08-24 17:53 UTC (permalink / raw)
To: Linux PM
Cc: Greg Kroah-Hartman, Danilo Krummrich, Daniel Lezcano, LKML,
Lukasz Luba, Linux Driver Core Development
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
This reverts commit 34f54003643e ("thermal/core: Allocate the thermal
class dynamically") that went against driver core changes aiming at the
elimination of class_create() [1].
No intentional functional impact.
Link: https://lore.kernel.org/linux-pm/2026082411-flask-rewire-434f@gregkh/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_core.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 2d9d8740491f..82e2f0d8a26d 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -889,7 +889,9 @@ static void thermal_unbind_cdev_from_trip(struct thermal_zone_device *tz,
kfree(pos);
}
-static struct class *thermal_class __ro_after_init;
+static const struct class thermal_class = {
+ .name = "thermal",
+};
static bool thermal_class_unavailable __ro_after_init = true;
static inline
@@ -1011,7 +1013,7 @@ int thermal_cooling_device_add(struct thermal_cooling_device *cdev, void *devdat
mutex_init(&cdev->lock);
INIT_LIST_HEAD(&cdev->thermal_instances);
cdev->updated = false;
- cdev->device.class = thermal_class;
+ cdev->device.class = &thermal_class;
cdev->device.release = thermal_cdev_release;
device_initialize(&cdev->device);
cdev->devdata = devdata;
@@ -1484,7 +1486,7 @@ thermal_zone_device_register_with_trips(const char *type,
if (!tz->ops.critical)
tz->ops.critical = thermal_zone_device_critical;
- tz->device.class = thermal_class;
+ tz->device.class = &thermal_class;
tz->device.release = thermal_zone_device_release;
tz->devdata = devdata;
tz->num_trips = num_trips;
@@ -1790,7 +1792,6 @@ void thermal_pm_complete(void)
static int __init thermal_init(void)
{
- struct class *tc;
int result;
thermal_debug_init();
@@ -1809,13 +1810,10 @@ static int __init thermal_init(void)
if (result)
goto unregister_governors;
- tc = class_create("thermal");
- if (IS_ERR(tc)) {
- result = PTR_ERR(tc);
+ result = class_register(&thermal_class);
+ if (result)
goto unregister_governors;
- }
- thermal_class = tc;
thermal_class_unavailable = false;
return 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes
2026-08-24 17:50 [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Rafael J. Wysocki
2026-08-24 17:52 ` [PATCH v1 1/2] Revert "thermal/core: Use the thermal class pointer as init guard" Rafael J. Wysocki
2026-08-24 17:53 ` [PATCH v1 2/2] Revert "thermal/core: Allocate the thermal class dynamically" Rafael J. Wysocki
@ 2026-08-25 5:55 ` Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-25 5:55 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM, Danilo Krummrich, Daniel Lezcano, LKML, Lukasz Luba,
Linux Driver Core Development
On Mon, Aug 24, 2026 at 07:50:52PM +0200, Rafael J. Wysocki wrote:
> Hi All,
>
> Two recent thermal core commits restored the usage of class_create()
> into the thermal core as a cleanup matter, but that goes against the
> driver core plans to get rid of that function.
>
> Revert these two commits and let class_create() be eliminated.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-25 5:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 17:50 [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Rafael J. Wysocki
2026-08-24 17:52 ` [PATCH v1 1/2] Revert "thermal/core: Use the thermal class pointer as init guard" Rafael J. Wysocki
2026-08-24 17:53 ` [PATCH v1 2/2] Revert "thermal/core: Allocate the thermal class dynamically" Rafael J. Wysocki
2026-08-25 5:55 ` [PATCH v1 0/2] thermal: core: Revert two cosmetic update that go against driver core changes Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox