File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -311,18 +311,24 @@ static void handle_non_critical_trips(struct thermal_zone_device *tz,
311311 def_governor -> throttle (tz , trip );
312312}
313313
314- void thermal_zone_device_critical (struct thermal_zone_device * tz )
314+ static void thermal_zone_device_halt (struct thermal_zone_device * tz , bool shutdown )
315315{
316316 /*
317317 * poweroff_delay_ms must be a carefully profiled positive value.
318318 * Its a must for forced_emergency_poweroff_work to be scheduled.
319319 */
320320 int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS ;
321+ const char * msg = "Temperature too high" ;
322+
323+ dev_emerg (& tz -> device , "%s: critical temperature reached\n" , tz -> type );
321324
322- dev_emerg (& tz -> device , "%s: critical temperature reached, "
323- "shutting down\n" , tz -> type );
325+ if (shutdown )
326+ hw_protection_shutdown (msg , poweroff_delay_ms );
327+ }
324328
325- hw_protection_shutdown ("Temperature too high" , poweroff_delay_ms );
329+ void thermal_zone_device_critical (struct thermal_zone_device * tz )
330+ {
331+ thermal_zone_device_halt (tz , true);
326332}
327333EXPORT_SYMBOL (thermal_zone_device_critical );
328334
Original file line number Diff line number Diff line change @@ -177,7 +177,12 @@ void ctrl_alt_del(void);
177177
178178extern void orderly_poweroff (bool force );
179179extern void orderly_reboot (void );
180- void hw_protection_shutdown (const char * reason , int ms_until_forced );
180+ void __hw_protection_shutdown (const char * reason , int ms_until_forced , bool shutdown );
181+
182+ static inline void hw_protection_shutdown (const char * reason , int ms_until_forced )
183+ {
184+ __hw_protection_shutdown (reason , ms_until_forced , true);
185+ }
181186
182187/*
183188 * Emergency restart, callable from an interrupt handler.
Original file line number Diff line number Diff line change @@ -957,7 +957,7 @@ static void hw_failure_emergency_poweroff(int poweroff_delay_ms)
957957}
958958
959959/**
960- * hw_protection_shutdown - Trigger an emergency system poweroff
960+ * __hw_protection_shutdown - Trigger an emergency system poweroff
961961 *
962962 * @reason: Reason of emergency shutdown to be printed.
963963 * @ms_until_forced: Time to wait for orderly shutdown before tiggering a
@@ -971,7 +971,7 @@ static void hw_failure_emergency_poweroff(int poweroff_delay_ms)
971971 * if the previous request has given a large timeout for forced shutdown.
972972 * Can be called from any context.
973973 */
974- void hw_protection_shutdown (const char * reason , int ms_until_forced )
974+ void __hw_protection_shutdown (const char * reason , int ms_until_forced , bool shutdown )
975975{
976976 static atomic_t allow_proceed = ATOMIC_INIT (1 );
977977
@@ -986,9 +986,9 @@ void hw_protection_shutdown(const char *reason, int ms_until_forced)
986986 * orderly_poweroff failure
987987 */
988988 hw_failure_emergency_poweroff (ms_until_forced );
989- orderly_poweroff (true);
989+ if (shutdown )
990+ orderly_poweroff (true);
990991}
991- EXPORT_SYMBOL_GPL (hw_protection_shutdown );
992992
993993static int __init reboot_setup (char * str )
994994{
You can’t perform that action at this time.
0 commit comments