File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,14 @@ static struct notifier_block parisc_panic_block = {
197
197
.priority = INT_MAX ,
198
198
};
199
199
200
+ /* qemu soft power-off function */
201
+ static int qemu_power_off (struct sys_off_data * data )
202
+ {
203
+ /* this turns the system off via SeaBIOS */
204
+ * (int * )data -> cb_data = 0 ;
205
+ pdc_soft_power_button (1 );
206
+ return NOTIFY_DONE ;
207
+ }
200
208
201
209
static int __init power_init (void )
202
210
{
@@ -226,7 +234,13 @@ static int __init power_init(void)
226
234
soft_power_reg );
227
235
}
228
236
229
- power_task = kthread_run (kpowerswd , (void * )soft_power_reg , KTHREAD_NAME );
237
+ power_task = NULL ;
238
+ if (running_on_qemu && soft_power_reg )
239
+ register_sys_off_handler (SYS_OFF_MODE_POWER_OFF , SYS_OFF_PRIO_DEFAULT ,
240
+ qemu_power_off , (void * )soft_power_reg );
241
+ else
242
+ power_task = kthread_run (kpowerswd , (void * )soft_power_reg ,
243
+ KTHREAD_NAME );
230
244
if (IS_ERR (power_task )) {
231
245
printk (KERN_ERR DRIVER_NAME ": thread creation failed. Driver not loaded.\n" );
232
246
pdc_soft_power_button (0 );
You can’t perform that action at this time.
0 commit comments