summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/thermal/thermal_core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 7dc77bdb29d0..db0164459bbe 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -368,7 +368,7 @@ static void sensor_update_work(struct work_struct *work)
mutex_unlock(&sensor->lock);
}
-/* May be called in an interrupt context.
+/* Should not be called in an interrupt context.
* Do NOT call sensor_set_trip from this function
*/
int thermal_sensor_trip(struct thermal_zone_device *tz,
@@ -384,6 +384,8 @@ int thermal_sensor_trip(struct thermal_zone_device *tz,
if (list_empty(&tz->sensor.threshold_list))
return 0;
+ mutex_lock(&tz->sensor.lock);
+
list_for_each_entry_safe(pos, var, &tz->sensor.threshold_list, list) {
if ((pos->trip != trip) || (!pos->active))
continue;
@@ -402,6 +404,8 @@ int thermal_sensor_trip(struct thermal_zone_device *tz,
}
}
+ mutex_unlock(&tz->sensor.lock);
+
schedule_work(&tz->sensor.work);
return ret;