Skip to content

Commit

Permalink
thermal: core: skip update disabled thermal zones after suspend
Browse files Browse the repository at this point in the history
It is unnecessary to update disabled thermal zones post suspend and
sometimes leads error/warning in bad behaved thermal drivers.

Signed-off-by: Wei Wang <wvw@google.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Wei Wang authored and Zhang Rui committed May 6, 2019
1 parent f991de5 commit ff54bbd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/thermal/thermal_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
unsigned long mode, void *_unused)
{
struct thermal_zone_device *tz;
enum thermal_device_mode tz_mode;

switch (mode) {
case PM_HIBERNATION_PREPARE:
Expand All @@ -1506,6 +1507,13 @@ static int thermal_pm_notify(struct notifier_block *nb,
case PM_POST_SUSPEND:
atomic_set(&in_suspend, 0);
list_for_each_entry(tz, &thermal_tz_list, node) {
tz_mode = THERMAL_DEVICE_ENABLED;
if (tz->ops->get_mode)
tz->ops->get_mode(tz, &tz_mode);

if (tz_mode == THERMAL_DEVICE_DISABLED)
continue;

thermal_zone_device_init(tz);
thermal_zone_device_update(tz,
THERMAL_EVENT_UNSPECIFIED);
Expand Down

0 comments on commit ff54bbd

Please sign in to comment.