File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Expand file tree Collapse file tree 3 files changed +20
-9
lines changed 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,
311
311
def_governor -> throttle (tz , trip );
312
312
}
313
313
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 )
315
315
{
316
316
/*
317
317
* poweroff_delay_ms must be a carefully profiled positive value.
318
318
* Its a must for forced_emergency_poweroff_work to be scheduled.
319
319
*/
320
320
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 );
321
324
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
+ }
324
328
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);
326
332
}
327
333
EXPORT_SYMBOL (thermal_zone_device_critical );
328
334
Original file line number Diff line number Diff line change @@ -177,7 +177,12 @@ void ctrl_alt_del(void);
177
177
178
178
extern void orderly_poweroff (bool force );
179
179
extern 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
+ }
181
186
182
187
/*
183
188
* 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)
957
957
}
958
958
959
959
/**
960
- * hw_protection_shutdown - Trigger an emergency system poweroff
960
+ * __hw_protection_shutdown - Trigger an emergency system poweroff
961
961
*
962
962
* @reason: Reason of emergency shutdown to be printed.
963
963
* @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)
971
971
* if the previous request has given a large timeout for forced shutdown.
972
972
* Can be called from any context.
973
973
*/
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 )
975
975
{
976
976
static atomic_t allow_proceed = ATOMIC_INIT (1 );
977
977
@@ -986,9 +986,9 @@ void hw_protection_shutdown(const char *reason, int ms_until_forced)
986
986
* orderly_poweroff failure
987
987
*/
988
988
hw_failure_emergency_poweroff (ms_until_forced );
989
- orderly_poweroff (true);
989
+ if (shutdown )
990
+ orderly_poweroff (true);
990
991
}
991
- EXPORT_SYMBOL_GPL (hw_protection_shutdown );
992
992
993
993
static int __init reboot_setup (char * str )
994
994
{
You can’t perform that action at this time.
0 commit comments