From b4bb592d09a5ce8474a4d4f0d0e13c3ba61b9f1d Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Mon, 18 Jul 2016 15:05:38 +0900 Subject: [PATCH] [COMMON] thermal: core: Check thermal_zone mode. If mode is THERMAL_DEVICE_DISABLED, skip reading temperature and throttling. Change-Id: I708c9f29ee417c8f6fc941162d9aa403a88dc084 Signed-off-by: Hyeonseong Gil --- drivers/thermal/thermal_core.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c4eca6f9355b..5bad0fc13ff8 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -468,24 +468,29 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event) { int count; + enum thermal_device_mode mode; if (atomic_read(&in_suspend)) return; - if (!tz->ops->get_temp) + if (!tz->ops->get_temp || !tz->ops->get_mode) return; - update_temperature(tz); + tz->ops->get_mode(tz, &mode); - thermal_zone_set_trips(tz); + if (mode == THERMAL_DEVICE_ENABLED) { + update_temperature(tz); - tz->notify_event = event; + thermal_zone_set_trips(tz); - for (count = 0; count < tz->trips; count++) - handle_thermal_trip(tz, count); + tz->notify_event = event; - if (tz->ops->throttle_hotplug) - tz->ops->throttle_hotplug(tz); + for (count = 0; count < tz->trips; count++) + handle_thermal_trip(tz, count); + + if (tz->ops->throttle_hotplug) + tz->ops->throttle_hotplug(tz); + } } EXPORT_SYMBOL_GPL(thermal_zone_device_update); -- 2.20.1