Skip to content

Commit 17cbb07

Browse files
seehearfeeltsbogend
authored andcommitted
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>
1 parent f17d3f2 commit 17cbb07

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎drivers/platform/mips/cpu_hwmon.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,17 @@ static struct delayed_work thermal_work;
153153

154154
static void do_thermal_timer(struct work_struct *work)
155155
{
156-
int i, value, temp_max = 0;
156+
int i, value;
157157

158158
for (i = 0; i < nr_packages; i++) {
159159
value = loongson3_cpu_temp(i);
160-
if (value > temp_max)
161-
temp_max = value;
160+
if (value > CPU_THERMAL_THRESHOLD) {
161+
pr_emerg("Power off due to high temp: %d\n", value);
162+
orderly_poweroff(true);
163+
}
162164
}
163165

164-
if (temp_max <= CPU_THERMAL_THRESHOLD)
165-
schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000));
166-
else
167-
orderly_poweroff(true);
166+
schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000));
168167
}
169168

170169
static int __init loongson_hwmon_init(void)

0 commit comments

Comments
 (0)