arm/xen: Consolidate calls to shutdown hypercall in a single helper

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Julien Grall 2017-04-24 18:58:38 +01:00 committed by Juergen Gross
parent 5d9404e118
commit fa12a870a9
1 changed files with 10 additions and 6 deletions

View File

@ -191,20 +191,24 @@ static int xen_dying_cpu(unsigned int cpu)
return 0;
}
static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
void xen_reboot(int reason)
{
struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
struct sched_shutdown r = { .reason = reason };
int rc;
rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
BUG_ON(rc);
}
static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
{
xen_reboot(SHUTDOWN_reboot);
}
static void xen_power_off(void)
{
struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
int rc;
rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
BUG_ON(rc);
xen_reboot(SHUTDOWN_poweroff);
}
static irqreturn_t xen_arm_callback(int irq, void *arg)