Re: [PATCH] thermal: core: skip update disabled thermal zones after suspend
From: Zhang Rui
Date: Mon Apr 22 2019 - 05:03:27 EST
On ä, 2019-04-16 at 10:07 -0700, Wei Wang wrote:
> It is unnecessary to update disabled thermal zones post suspend and
> sometimes leads error/warning in bad behaved thermal drivers.
>
a good catch, and in fact, there are more issues about thermal handling
for disabled thermal zones, like we're able to read the temperature of
disabled thermal zones, either via sysfs or via function calls like
thermal_zone_device_update.
For this patch, I will take it as it fixes one of the problem.
thanks,
rui
> Signed-off-by: Wei Wang <wvw@xxxxxxxxxx>
> ---
> Âdrivers/thermal/thermal_core.c | 8 ++++++++
> Â1 file changed, 8 insertions(+)
>
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index 6590bb5cb688..5baf5cfab999 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -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:
> @@ -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_UNS
> PECIFIED);