diff mbox series

[2/3,v2] arm/xen: Consolidate calls to shutdown hypercall in a single helper

Message ID 20170424175839.5262-3-julien.grall@arm.com
State Accepted
Commit fa12a870a9d594ba458242a04a4d17a76fc816a4
Headers show
Series xen: Implement EFI reset_system callback | expand

Commit Message

Julien Grall April 24, 2017, 5:58 p.m. UTC
Signed-off-by: Julien Grall <julien.grall@arm.com>


---
    Changes in v2:
        - Patch added
---
 arch/arm/xen/enlighten.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stefano Stabellini April 24, 2017, 7:30 p.m. UTC | #1
On Mon, 24 Apr 2017, Julien Grall wrote:
> Signed-off-by: Julien Grall <julien.grall@arm.com>


Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>



> ---

>     Changes in v2:

>         - Patch added

> ---

>  arch/arm/xen/enlighten.c | 16 ++++++++++------

>  1 file changed, 10 insertions(+), 6 deletions(-)

> 

> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c

> index 81e3217b12d3..ba7f4c8f5c3e 100644

> --- a/arch/arm/xen/enlighten.c

> +++ b/arch/arm/xen/enlighten.c

> @@ -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)

> -- 

> 2.11.0

> 

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 81e3217b12d3..ba7f4c8f5c3e 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -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)