diff options
author | Tiezhu Yang | 2020-07-09 11:55:20 +0800 |
---|---|---|
committer | Thomas Bogendoerfer | 2020-07-16 10:49:36 +0200 |
commit | 17cbb0702e89f36db7608a441e9557088bd790ea (patch) | |
tree | ea57de0e9f1a9f8cd673d42f3b965bf15f0389cb | |
parent | f17d3f218d8639ea6195ce2c027f2bd83ed12e30 (diff) |
MIPS: Loongson: Reduce possible loop times and add log in do_thermal_timer()
Once the temperature of any CPUs is too high, it can power off immediately,
no need to check the rest of CPUs, and it is better to print a log before
power off, this is useful when analysis the abnormal issues.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Zhi Li <lizhi01@loongson.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-rw-r--r-- | drivers/platform/mips/cpu_hwmon.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c index fa42b13f2e56..c9f35e5d0b89 100644 --- a/drivers/platform/mips/cpu_hwmon.c +++ b/drivers/platform/mips/cpu_hwmon.c @@ -153,18 +153,17 @@ static struct delayed_work thermal_work; static void do_thermal_timer(struct work_struct *work) { - int i, value, temp_max = 0; + int i, value; for (i = 0; i < nr_packages; i++) { value = loongson3_cpu_temp(i); - if (value > temp_max) - temp_max = value; + if (value > CPU_THERMAL_THRESHOLD) { + pr_emerg("Power off due to high temp: %d\n", value); + orderly_poweroff(true); + } } - if (temp_max <= CPU_THERMAL_THRESHOLD) - schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000)); - else - orderly_poweroff(true); + schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000)); } static int __init loongson_hwmon_init(void) |