[PATCH] thermal/core: associate device tree node to thermal_cooling_device::device

Jianeng Chen posted 1 patch 2 years, 7 months ago
drivers/thermal/thermal_core.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] thermal/core: associate device tree node to thermal_cooling_device::device
Posted by Jianeng Chen 2 years, 7 months ago
When adding a gpio property to a cooling device node in device tree, then in
thermal driver called gpiod_get(struct device *) to request this gpio will
fail, indicate cannot find gpio in device tree, because the of node do not
associate to struct device.

Signed-off-by: Jianeng Chen <jianengchencool@gmail.com>
---
 drivers/thermal/thermal_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 0675df5..4d77d8b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -905,6 +905,7 @@ __thermal_cooling_device_register(struct device_node *np,
 	cdev->ops = ops;
 	cdev->updated = false;
 	cdev->device.class = thermal_class;
+	cdev->device.of_node = np;
 	cdev->devdata = devdata;
 
 	ret = cdev->ops->get_max_state(cdev, &cdev->max_state);
-- 
2.7.4