Skip to content

Commit 934c93b

Browse files
saschahauerzhang-rui
authored andcommitted
thermal: Add comment explaining test for critical temperature
The code testing if a temperature should be emulated or not is not obvious. Add a comment explaining why this test is done. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
1 parent 79e5421 commit 934c93b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/thermal/thermal_core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,11 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
498498
}
499499
}
500500

501+
/*
502+
* Only allow emulating a temperature when the real temperature
503+
* is below the critical temperature so that the emulation code
504+
* cannot hide critical conditions.
505+
*/
501506
if (!ret && *temp < crit_temp)
502507
*temp = tz->emul_temperature;
503508
}

0 commit comments

Comments
 (0)