summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorFinley Xiao <finley.xiao@rock-chips.com>2018-06-27 11:07:25 +0800
committerTao Huang <huangtao@rock-chips.com>2018-07-06 19:36:38 +0800
commit60b250f9b62b529ccbe7292cb4c3d0f053c15137 (patch)
tree7868755e13e26dab25eb7dde0000016b086a3269 /drivers/thermal
parent629b83c413ad0c6dea83c9e6052e40fd75faf255 (diff)
thermal: Add thermal_notifier_list for thermal zone
Change-Id: I92c3308a4582ec3dbc03d2d6f2bbda60efe7245a Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_core.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index b26e6f7a050c..7e71f5b01cca 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -612,6 +612,11 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
thermal_zone_set_trips(tz);
+#ifdef CONFIG_ARCH_ROCKCHIP
+ srcu_notifier_call_chain(&tz->thermal_notifier_list,
+ tz->temperature, tz);
+#endif
+
for (count = 0; count < tz->trips; count++)
handle_thermal_trip(tz, count);
}
@@ -1870,7 +1875,9 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL);
if (!tz)
return ERR_PTR(-ENOMEM);
-
+#ifdef CONFIG_ARCH_ROCKCHIP
+ srcu_init_notifier_head(&tz->thermal_notifier_list);
+#endif
INIT_LIST_HEAD(&tz->thermal_instances);
idr_init(&tz->idr);
mutex_init(&tz->lock);
@@ -2067,6 +2074,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
thermal_set_governor(tz, NULL);
thermal_remove_hwmon_sysfs(tz);
+#ifdef CONFIG_ARCH_ROCKCHIP
+ srcu_cleanup_notifier_head(&tz->thermal_notifier_list);
+#endif
release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
idr_destroy(&tz->idr);
mutex_destroy(&tz->lock);