From ada52037ba781c9c80fe543150b05838c9c4f486 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Mon, 9 Mar 2015 15:57:10 +0800 Subject: [PATCH] Debug-patch-to-sync-thermal-zone-update --- drivers/thermal/step_wise.c | 6 ------ drivers/thermal/thermal_core.c | 16 +++++----------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index 5a0f12d..3fd1977 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -138,7 +138,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) dev_dbg(&tz->device, "Trip%d[type=%d,temp=%ld]:trend=%d,throttle=%d\n", trip, trip_type, trip_temp, trend, throttle); - mutex_lock(&tz->lock); list_for_each_entry(instance, &tz->thermal_instances, tz_node) { if (instance->trip != trip) @@ -164,8 +163,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) instance->cdev->updated = false; /* cdev needs update */ } - - mutex_unlock(&tz->lock); } /** @@ -189,13 +186,10 @@ static int step_wise_throttle(struct thermal_zone_device *tz, int trip) if (tz->forced_passive) thermal_zone_trip_update(tz, THERMAL_TRIPS_NONE); - mutex_lock(&tz->lock); list_for_each_entry(instance, &tz->thermal_instances, tz_node) thermal_cdev_update(instance->cdev); - mutex_unlock(&tz->lock); - return 0; } diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 48491d1..ebc1ccd 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -341,16 +341,12 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, static void monitor_thermal_zone(struct thermal_zone_device *tz) { - mutex_lock(&tz->lock); - if (tz->passive) thermal_zone_device_set_polling(tz, tz->passive_delay); else if (tz->polling_delay) thermal_zone_device_set_polling(tz, tz->polling_delay); else thermal_zone_device_set_polling(tz, 0); - - mutex_unlock(&tz->lock); } static void handle_non_critical_trips(struct thermal_zone_device *tz, @@ -423,12 +419,10 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) if (!tz || IS_ERR(tz) || !tz->ops->get_temp) goto exit; - mutex_lock(&tz->lock); - ret = tz->ops->get_temp(tz, temp); #ifdef CONFIG_THERMAL_EMULATION if (!tz->emul_temperature) - goto skip_emul; + goto exit; for (count = 0; count < tz->trips; count++) { ret = tz->ops->get_trip_type(tz, count, &type); @@ -443,9 +437,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) if (*temp < crit_temp) *temp = tz->emul_temperature; -skip_emul: #endif - mutex_unlock(&tz->lock); exit: return ret; } @@ -463,10 +455,8 @@ static void update_temperature(struct thermal_zone_device *tz) return; } - mutex_lock(&tz->lock); tz->last_temperature = tz->temperature; tz->temperature = temp; - mutex_unlock(&tz->lock); trace_thermal_temperature(tz); dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", @@ -477,6 +467,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) { int count; + mutex_lock(&tz->lock); + if (!tz->ops->get_temp) return; @@ -484,6 +476,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) for (count = 0; count < tz->trips; count++) handle_thermal_trip(tz, count); + + mutex_unlock(&tz->lock); } EXPORT_SYMBOL_GPL(thermal_zone_device_update); -- 1.9.1