Commit 17cbb070 authored by Tiezhu Yang's avatar Tiezhu Yang Committed by Thomas Bogendoerfer

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: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: default avatarZhi Li <lizhi01@loongson.cn>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent f17d3f21
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment