File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,6 +197,14 @@ static struct notifier_block parisc_panic_block = {
197197 .priority = INT_MAX ,
198198};
199199
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+ }
200208
201209static int __init power_init (void )
202210{
@@ -226,7 +234,13 @@ static int __init power_init(void)
226234 soft_power_reg );
227235 }
228236
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 );
230244 if (IS_ERR (power_task )) {
231245 printk (KERN_ERR DRIVER_NAME ": thread creation failed. Driver not loaded.\n" );
232246 pdc_soft_power_button (0 );
You can’t perform that action at this time.
0 commit comments