diff mbox series

thermal/of: Accept but warn about TZ without trip

Message ID 20221028114433.51839-1-linus.walleij@linaro.org
State New
Headers show
Series thermal/of: Accept but warn about TZ without trip | expand

Commit Message

Linus Walleij Oct. 28, 2022, 11:44 a.m. UTC
From: Daniel Lezcano <daniel.lezcano@linaro.org>

The thermal OF core used to accept the creation of thermal zones
without trip points, but recent changes made it error out as
thermal zones should according to specification have trip
points.

Relax the requirements so we still create those thermal zones
but make a request to update the DTS in the kernel log.

Fixes: 3fd6d6e2b4e8 ("thermal/of: Rework the thermal device tree initialization")
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/thermal/thermal_of.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index d4b6335ace15..f683cbb4a72a 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -592,8 +592,8 @@  struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor,
 	struct thermal_zone_params *tzp;
 	struct thermal_zone_device_ops *of_ops;
 	struct device_node *np;
-	int delay, pdelay;
-	int ntrips, mask;
+	int delay = 0, pdelay = 0;
+	int ntrips = 0, mask = 0;
 	int ret;
 
 	of_ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
@@ -610,7 +610,9 @@  struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor,
 	trips = thermal_of_trips_init(np, &ntrips);
 	if (IS_ERR(trips)) {
 		pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id);
-		return ERR_CAST(trips);
+		pr_err("Trip points are compulsory for thermal zones, please add them to the DTS\n");
+		trips = NULL;
+		goto out_register;
 	}
 
 	ret = thermal_of_monitor_init(np, &delay, &pdelay);
@@ -636,6 +638,7 @@  struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor,
 
 	mask = GENMASK_ULL((ntrips) - 1, 0);
 
+out_register:
 	tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips,
 						     mask, data, of_ops, tzp,
 						     pdelay, delay);