[PATCH v2 03/12] thermal/core: Make thermal_cooling_device_init_complete() non static
From: Daniel Lezcano
Date: Wed Apr 22 2026 - 13:45:09 EST
In the process of separating clearly the OF code and the thermal core
code, let's split and export the
thermal_cooling_device_init_complete() function so it can be used by
an implementation inside the thermal OF code.
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>
---
drivers/thermal/thermal_core.c | 12 ++++++++----
drivers/thermal/thermal_core.h | 2 ++
drivers/thermal/thermal_of.c | 12 +++++++++++-
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 8a70768b46dd..35cf170f3fa1 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1028,7 +1028,7 @@ static void thermal_zone_cdev_bind(struct thermal_zone_device *tz,
__thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
}
-static void thermal_cooling_device_init_complete(struct thermal_cooling_device *cdev)
+void thermal_cooling_device_init_complete(struct thermal_cooling_device *cdev)
{
struct thermal_zone_device *tz;
@@ -1127,8 +1127,6 @@ __thermal_cooling_device_register(struct device_node *np,
if (current_state <= cdev->max_state)
thermal_debug_cdev_add(cdev, current_state);
- thermal_cooling_device_init_complete(cdev);
-
return cdev;
out_cooling_dev:
@@ -1159,7 +1157,13 @@ struct thermal_cooling_device *
thermal_cooling_device_register(const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{
- return __thermal_cooling_device_register(NULL, type, devdata, ops);
+ struct thermal_cooling_device *cdev;
+
+ cdev = __thermal_cooling_device_register(NULL, type, devdata, ops);
+ if (!IS_ERR(cdev))
+ thermal_cooling_device_init_complete(cdev);
+
+ return cdev;
}
EXPORT_SYMBOL_GPL(thermal_cooling_device_register);
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index bdd59947b24f..6e44bcf37b00 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -269,6 +269,8 @@ void thermal_zone_device_critical_shutdown(struct thermal_zone_device *tz);
void thermal_governor_update_tz(struct thermal_zone_device *tz,
enum thermal_notify_event reason);
+void thermal_cooling_device_init_complete(struct thermal_cooling_device *cdev);
+
struct thermal_cooling_device *
__thermal_cooling_device_register(struct device_node *np,
const char *type, void *devdata,
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 398157e740fc..c4b67554df44 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -531,7 +531,15 @@ thermal_of_cooling_device_register(struct device_node *np,
const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{
- return __thermal_cooling_device_register(np, type, devdata, ops);
+ struct thermal_cooling_device *cdev;
+
+ cdev = __thermal_cooling_device_register(np, type, devdata, ops);
+ if (IS_ERR(cdev))
+ return cdev;
+
+ thermal_cooling_device_init_complete(cdev);
+
+ return cdev;
}
EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register);
@@ -579,6 +587,8 @@ devm_thermal_of_cooling_device_register(struct device *dev,
*ptr = tcd;
devres_add(dev, ptr);
+ thermal_cooling_device_init_complete(tcd);
+
return tcd;
}
EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register);
--
2.43.0