[PATCH 3/3] MIPS: Loongson: Add log before power off due to high temperature

From: Tiezhu Yang
Date: Fri May 08 2020 - 07:55:14 EST


When the CPU temperature is too high, it is better to print a log before
power off, this is useful when analysis the abnormal issues.

Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
drivers/platform/mips/cpu_hwmon.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c
index 7b4bde1..6dfecd8 100644
--- a/drivers/platform/mips/cpu_hwmon.c
+++ b/drivers/platform/mips/cpu_hwmon.c
@@ -162,10 +162,12 @@ static void do_thermal_timer(struct work_struct *work)
temp_max = value;
}

- if (temp_max <= CPU_THERMAL_THRESHOLD)
+ if (temp_max <= CPU_THERMAL_THRESHOLD) {
schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000));
- else
+ } else {
+ pr_emerg("Power off due to high temperature: %d\n", value);
orderly_poweroff(true);
+ }
}

static int __init loongson_hwmon_init(void)
--
2.1.0