]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
thermal/core: Make cooling device OF node conditional on CONFIG_THERMAL_OF
authorDaniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Tue, 26 May 2026 14:08:05 +0000 (16:08 +0200)
committerDaniel Lezcano <daniel.lezcano@kernel.org>
Wed, 3 Jun 2026 07:12:51 +0000 (09:12 +0200)
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@oss.qualcomm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20260526140802.1059293-16-daniel.lezcano@oss.qualcomm.com
include/linux/thermal.h

index 3e663267a19d8c735357a58fbb0f5b13625ca35c..6d1862ac187f78eedec4b22a9f3e611d3e673b97 100644 (file)
@@ -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