Re: [PATCH v4 04/10] thermal/core: Make cooling device OF node conditional on CONFIG_THERMAL_OF
From: Lukasz Luba
Date: Fri May 29 2026 - 09:29:04 EST
On 5/26/26 15:08, Daniel Lezcano wrote:
The device node pointer stored in struct thermal_cooling_device is
only used by the OF-specific thermal code to associate cooling devices
with thermal zones defined in device tree.
Now that OF and non-OF registration paths are separated and non-OF
users no longer rely on devm_thermal_of_cooling_device_register() with
a NULL device node, the np field is no longer required for non-OF
configurations.
Make this field conditional on CONFIG_THERMAL_OF to reduce memory
footprint and better reflect its usage.
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>
---
include/linux/thermal.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index fc3f4a098370..60e596e7d7ae 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -125,7 +125,6 @@ struct thermal_cooling_device {
const char *type;
unsigned long max_state;
struct device device;
- struct device_node *np;
void *devdata;
void *stats;
const struct thermal_cooling_device_ops *ops;
@@ -133,6 +132,9 @@ struct thermal_cooling_device {
struct mutex lock; /* protect thermal_instances list */
struct list_head thermal_instances;
struct list_head node;
+#ifdef CONFIG_THERMAL_OF
+ struct device_node *np;
+#endif
#ifdef CONFIG_THERMAL_DEBUGFS
struct thermal_debugfs *debugfs;
#endif
I've done compilation w/o THERMAL_OF set because it
was a bit odd...
It triggers an issue in the thermal_core.c at:
cdev->np which is left. This might break some bisect
in the suture if that would be the case.
drivers/thermal/thermal_core.c: In function ‘thermal_of_cooling_device_register’:
drivers/thermal/thermal_core.c:1121:13: error: ‘struct thermal_cooling_device’ has no member named ‘np’
1121 | cdev->np = np;
| ^~
make[4]: *** [scripts/Makefile.build:289: drivers/thermal/thermal_core.o] Error 1
make[3]: *** [scripts/Makefile.build:548: drivers/thermal] Error 2
make[3]: *** Waiting for unfinished jobs....
Let's maybe change the order with patch 05/10 ?