Skip to content

Commit d0d738a

Browse files
ndreysScott Wood
authored andcommitted
powerpc: Factor out common code in setup-common.c
Factor out a small bit of common code in machine_restart(), machine_power_off() and machine_halt(). Signed-off-by: Andrey Smirnov <[email protected]> Signed-off-by: Scott Wood <[email protected]>
1 parent 625f3ee commit d0d738a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

arch/powerpc/kernel/setup-common.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,32 @@ void machine_shutdown(void)
131131
ppc_md.machine_shutdown();
132132
}
133133

134+
static void machine_hang(void)
135+
{
136+
pr_emerg("System Halted, OK to turn off power\n");
137+
local_irq_disable();
138+
while (1)
139+
;
140+
}
141+
134142
void machine_restart(char *cmd)
135143
{
136144
machine_shutdown();
137145
if (ppc_md.restart)
138146
ppc_md.restart(cmd);
147+
139148
smp_send_stop();
140-
printk(KERN_EMERG "System Halted, OK to turn off power\n");
141-
local_irq_disable();
142-
while (1) ;
149+
machine_hang();
143150
}
144151

145152
void machine_power_off(void)
146153
{
147154
machine_shutdown();
148155
if (pm_power_off)
149156
pm_power_off();
157+
150158
smp_send_stop();
151-
printk(KERN_EMERG "System Halted, OK to turn off power\n");
152-
local_irq_disable();
153-
while (1) ;
159+
machine_hang();
154160
}
155161
/* Used by the G5 thermal driver */
156162
EXPORT_SYMBOL_GPL(machine_power_off);
@@ -163,10 +169,9 @@ void machine_halt(void)
163169
machine_shutdown();
164170
if (ppc_md.halt)
165171
ppc_md.halt();
172+
166173
smp_send_stop();
167-
printk(KERN_EMERG "System Halted, OK to turn off power\n");
168-
local_irq_disable();
169-
while (1) ;
174+
machine_hang();
170175
}
171176

172177

0 commit comments

Comments
 (0)