[COMMON] thermal: core: Check thermal_zone mode.
authorHyeonseong Gil <hs.gil@samsung.com>
Mon, 18 Jul 2016 06:05:38 +0000 (15:05 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:04 +0000 (17:13 +0900)
If mode is THERMAL_DEVICE_DISABLED,
skip reading temperature and throttling.

Change-Id: I708c9f29ee417c8f6fc941162d9aa403a88dc084
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/thermal_core.c

index c4eca6f9355babbb332a331468e4d54219dda13d..5bad0fc13ff8b2e3843a3bf2cf290e9d94ada77b 100644 (file)
@@ -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);