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 <[email protected]>
---
 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

Reply via email to