From 60b250f9b62b529ccbe7292cb4c3d0f053c15137 Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Wed, 27 Jun 2018 11:07:25 +0800 Subject: thermal: Add thermal_notifier_list for thermal zone Change-Id: I92c3308a4582ec3dbc03d2d6f2bbda60efe7245a Signed-off-by: Finley Xiao --- drivers/thermal/thermal_core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'drivers/thermal') 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); -- cgit v1.2.3