[PATCH v1 08/14] thermal/core: Move OF functions def in the CONFIG_OF section in thermal.h

From: Daniel Lezcano

Date: Sun Apr 19 2026 - 14:26:34 EST


Now that OF functions are used only by OF drivers, let's move and
group the functions definitions under the CONFIG_OF block. There is no
need to keep them out because of non-OF drivers using them.

Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>
---
include/linux/thermal.h | 48 +++++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index d9332b037188..f7b8651c1ed0 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -198,6 +198,16 @@ struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, in

void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zone_device *tz);

+struct thermal_cooling_device *
+thermal_of_cooling_device_register(struct device_node *np,
+ const char *type, void *data,
+ const struct thermal_cooling_device_ops *ops);
+
+struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev,
+ struct device_node *np,
+ const char *type, void *devdata,
+ const struct thermal_cooling_device_ops *ops);
#else

static inline
@@ -211,6 +221,23 @@ static inline void devm_thermal_of_zone_unregister(struct device *dev,
struct thermal_zone_device *tz)
{
}
+
+static inline struct thermal_cooling_device *
+thermal_of_cooling_device_register(struct device_node *np,
+ const char *type, void *devdata,
+ const struct thermal_cooling_device_ops *ops)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev,
+ struct device_node *np,
+ const char *type, void *devdata,
+ const struct thermal_cooling_device_ops *ops)
+{
+ return ERR_PTR(-ENODEV);
+}
#endif

int for_each_thermal_trip(struct thermal_zone_device *tz,
@@ -252,14 +279,6 @@ void thermal_zone_device_update(struct thermal_zone_device *,

struct thermal_cooling_device *thermal_cooling_device_register(const char *,
void *, const struct thermal_cooling_device_ops *);
-struct thermal_cooling_device *
-thermal_of_cooling_device_register(struct device_node *np, const char *, void *,
- const struct thermal_cooling_device_ops *);
-struct thermal_cooling_device *
-devm_thermal_of_cooling_device_register(struct device *dev,
- struct device_node *np,
- const char *type, void *devdata,
- const struct thermal_cooling_device_ops *ops);

struct thermal_cooling_device *
devm_thermal_cooling_device_register(struct device *dev, const char *type,
@@ -309,19 +328,6 @@ static inline struct thermal_cooling_device *
thermal_cooling_device_register(const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{ return ERR_PTR(-ENODEV); }
-static inline struct thermal_cooling_device *
-thermal_of_cooling_device_register(struct device_node *np,
- const char *type, void *devdata,
- const struct thermal_cooling_device_ops *ops)
-{ return ERR_PTR(-ENODEV); }
-static inline struct thermal_cooling_device *
-devm_thermal_of_cooling_device_register(struct device *dev,
- struct device_node *np,
- const char *type, void *devdata,
- const struct thermal_cooling_device_ops *ops)
-{
- return ERR_PTR(-ENODEV);
-}

struct thermal_cooling_device *
devm_thermal_cooling_device_register(struct device *dev, const char *type,
--
2.43.0