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>
This commit is contained in:
Sascha Hauer 2015-07-06 09:46:17 +02:00 committed by Zhang Rui
parent 79e5421cf0
commit 934c93b8c1

View file

@ -498,6 +498,11 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
} }
} }
/*
* Only allow emulating a temperature when the real temperature
* is below the critical temperature so that the emulation code
* cannot hide critical conditions.
*/
if (!ret && *temp < crit_temp) if (!ret && *temp < crit_temp)
*temp = tz->emul_temperature; *temp = tz->emul_temperature;
} }