The patch....
Signed-off-by: Lukasz Luba l.luba@partner.samsung.com --- drivers/thermal/thermal_core.c | 25 +++++++++++++------------ include/linux/thermal.h | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index a3d80553b590..7b998297db20 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -799,6 +799,19 @@ static bool thermal_cdev_in_tz(struct thermal_cooling_device *cdev, return false; }
+void thermal_all_zones_recalc_power(void) +{ + struct thermal_zone_device *tz; + + mutex_lock(&thermal_list_lock); + list_for_each_entry(tz, &thermal_tz_list, node) + thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); + + mutex_unlock(&thermal_list_lock); + +} +EXPORT_SYMBOL_GPL(thermal_all_zones_recalc_power); + int thermal_cpu_cdev_set_weight(int cpu, unsigned long weight) { struct thermal_cooling_device *cdev; @@ -822,18 +835,6 @@ int thermal_cpu_cdev_set_weight(int cpu, unsigned long weight) thermal_update_weight(instance, weight); mutex_unlock(&cdev->lock);
- /* Update thermal zones which are pinned to this cooling device. - * It will trigger recalculation of the states. - */ - mutex_lock(&thermal_list_lock); - list_for_each_entry(tz, &thermal_tz_list, node) { - if (thermal_cdev_in_tz(cdev, tz)) - thermal_zone_device_update(tz, - THERMAL_EVENT_UNSPECIFIED); - - } - mutex_unlock(&thermal_list_lock); - return 0; } EXPORT_SYMBOL_GPL(thermal_cpu_cdev_set_weight); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index baef42ccb3a5..6c944ab78d17 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -459,6 +459,7 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, void thermal_cdev_update(struct thermal_cooling_device *); void thermal_notify_framework(struct thermal_zone_device *, int); int thermal_cpu_cdev_set_weight(int cpu, unsigned long weight); +void thermal_all_zones_recalc_power(void); #else static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) { return false; } @@ -532,6 +533,7 @@ static inline void thermal_notify_framework(struct thermal_zone_device *tz, { } static inline int thermal_cpu_cdev_set_weight(int cpu, unsigned long weight) {} +void thermal_all_zones_recalc_power(void) {} #endif /* CONFIG_THERMAL */
#if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL)