From: Hyeonseong Gil Date: Mon, 18 Jul 2016 06:05:38 +0000 (+0900) Subject: [COMMON] thermal: core: Check thermal_zone mode. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b4bb592d09a5ce8474a4d4f0d0e13c3ba61b9f1d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [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 --- 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);