linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc: Factor out common code in setup-common.c
@ 2016-07-26  4:25 Andrey Smirnov
  2016-07-26  4:25 ` [PATCH 2/3] powerpc: Call chained reset handlers during reset Andrey Smirnov
  2016-07-26  4:25 ` [PATCH 3/3] powerpc: Convert fsl_rstcr_restart to a reset handler Andrey Smirnov
  0 siblings, 2 replies; 6+ messages in thread
From: Andrey Smirnov @ 2016-07-26  4:25 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Andrey Smirnov, Scott Wood, Kumar Gala, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Alessio Igor Bogani,
	Daniel Axtens, linux-kernel

Factor out a small bit of common code in machine_restart(),
machine_power_off() and machine_halt().

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/powerpc/kernel/setup-common.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 714b4ba..5cd3283 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -130,15 +130,22 @@ void machine_shutdown(void)
 		ppc_md.machine_shutdown();
 }
 
+static void machine_hang(void)
+{
+	pr_emerg("System Halted, OK to turn off power\n");
+	local_irq_disable();
+	while (1)
+		;
+}
+
 void machine_restart(char *cmd)
 {
 	machine_shutdown();
 	if (ppc_md.restart)
 		ppc_md.restart(cmd);
+
 	smp_send_stop();
-	printk(KERN_EMERG "System Halted, OK to turn off power\n");
-	local_irq_disable();
-	while (1) ;
+	machine_hang();
 }
 
 void machine_power_off(void)
@@ -146,10 +153,9 @@ void machine_power_off(void)
 	machine_shutdown();
 	if (pm_power_off)
 		pm_power_off();
+
 	smp_send_stop();
-	printk(KERN_EMERG "System Halted, OK to turn off power\n");
-	local_irq_disable();
-	while (1) ;
+	machine_hang();
 }
 /* Used by the G5 thermal driver */
 EXPORT_SYMBOL_GPL(machine_power_off);
@@ -162,10 +168,9 @@ void machine_halt(void)
 	machine_shutdown();
 	if (ppc_md.halt)
 		ppc_md.halt();
+
 	smp_send_stop();
-	printk(KERN_EMERG "System Halted, OK to turn off power\n");
-	local_irq_disable();
-	while (1) ;
+	machine_hang();
 }
 
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-26 21:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26  4:25 [PATCH 1/3] powerpc: Factor out common code in setup-common.c Andrey Smirnov
2016-07-26  4:25 ` [PATCH 2/3] powerpc: Call chained reset handlers during reset Andrey Smirnov
2016-07-26  4:25 ` [PATCH 3/3] powerpc: Convert fsl_rstcr_restart to a reset handler Andrey Smirnov
2016-07-26  7:59   ` Scott Wood
2016-07-26 21:22     ` Andrey Smirnov
2016-07-26 21:26       ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).