diff mbox series

[v2,01/13] thermal: Store device tree node for thermal zone devices

Message ID 20231012175836.3408077-2-thierry.reding@gmail.com
State New
Headers show
Series thermal: tegra: Do not register cooling device | expand

Commit Message

Thierry Reding Oct. 12, 2023, 5:58 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Store the device tree node for each thermal zone device to allow it to
be referenced.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- new patch to track thermal zone device tree nodes

 drivers/thermal/thermal_of.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index db83596ea105..2acb65e97090 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -443,6 +443,7 @@  static void thermal_of_zone_unregister(struct thermal_zone_device *tz)
 	struct thermal_zone_device_ops *ops = tz->ops;
 
 	thermal_zone_device_disable(tz);
+	of_node_put(tz->device.of_node);
 	thermal_zone_device_unregister(tz);
 	kfree(trips);
 	kfree(ops);
@@ -521,6 +522,8 @@  static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
 		goto out_kfree_trips;
 	}
 
+	tz->device.of_node = np;
+
 	ret = thermal_zone_device_enable(tz);
 	if (ret) {
 		pr_err("Failed to enabled thermal zone '%s', id=%d: %d\n",