]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arm/xen: Consolidate calls to shutdown hypercall in a single helper
authorJulien Grall <julien.grall@arm.com>
Mon, 24 Apr 2017 17:58:38 +0000 (18:58 +0100)
committerJuergen Gross <jgross@suse.com>
Tue, 2 May 2017 10:05:32 +0000 (12:05 +0200)
Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
arch/arm/xen/enlighten.c

index 81e3217b12d3349a365852c060dfc9b17fe17c63..ba7f4c8f5c3e4c9e6fac7282016ec2d33b32005c 100644 (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)