summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_of.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linexp.org>2022-08-05 01:43:18 +0300
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-08-17 15:09:37 +0300
commit48ad3b104b9ec85de58c2b4e38fdad9a26446f99 (patch)
tree8109f8ccbfd86ea4d09d60c7645bdb91cad84a7d /drivers/thermal/thermal_of.c
parent8fb5b71ed37dbe469eaa930e2ddc93ec9e305f3c (diff)
downloadlinux-48ad3b104b9ec85de58c2b4e38fdad9a26446f99.tar.xz
thermal/of: Make new code and old code co-exist
This transient change allows to use old and new OF together until all the drivers are converted to use the new OF API. This will go away when the old OF code will be removed. Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org> Link: https://lore.kernel.org/r/20220804224349.1926752-3-daniel.lezcano@linexp.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/thermal_of.c')
-rw-r--r--drivers/thermal/thermal_of.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index c5cbe254a4f1..a17087c9295d 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -485,6 +485,15 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data,
{
struct device_node *np, *child, *sensor_np;
struct thermal_zone_device *tzd = ERR_PTR(-ENODEV);
+ static int old_tz_initialized;
+ int ret;
+
+ if (!old_tz_initialized) {
+ ret = of_parse_thermal_zones();
+ if (ret)
+ return ERR_PTR(ret);
+ old_tz_initialized = 1;
+ }
np = of_find_node_by_name(NULL, "thermal-zones");
if (!np)
@@ -1004,7 +1013,7 @@ free_tz:
return ERR_PTR(ret);
}
-static __init void of_thermal_free_zone(struct __thermal_zone *tz)
+static void of_thermal_free_zone(struct __thermal_zone *tz)
{
struct __thermal_bind_params *tbp;
int i, j;
@@ -1523,7 +1532,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister);
* Return: 0 on success, proper error code otherwise
*
*/
-int __init of_parse_thermal_zones(void)
+int of_parse_thermal_zones(void)
{
struct device_node *np, *child;
struct __thermal_zone *tz;