* [PATCH -queue] Loongson: Cleanup the halt and poweroff action
@ 2010-01-27 14:39 Wu Zhangjin
2010-01-27 21:54 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Wu Zhangjin @ 2010-01-27 14:39 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Liu Shiwei, Wu Zhangjin, linux-mips
(Add linux-mips <linux-mips@linux-mips.org> into the CC: list to make the patchwork get it!)
From: Wu Zhangjin <wuzhangjin@gmail.com>
In the old source code, I have let halt and poweroff do the same action,
but in reality, they have different meanings.
As the manpage of shutdown shows:
-r Reboot after shutdown.
-H Halt action is to halt or drop into boot monitor on systems that support it.
-P Halt action is to turn off the power.
and in the real world, some machines(e.g. NAS) did not provide a power
button and the shutdown works as reset, so, we need to provide a
mechanism to let the users turn off the power safely without breaking
the system, such a mechanism is "halt", which only put the system into a
dead loop or a power-save mode and print some information to the screen
to tell the users to turn off the power safely.
$ shutdown -hH now /* loongson_halt, not turn off the power */
$ shutdown -hP now /* loongson_poweroff, work as poweroff */
Tested-by: Liu Shiwei <liushiwei@gmail.com>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
arch/mips/loongson/common/reset.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c
index 33dff18..4bd9c18 100644
--- a/arch/mips/loongson/common/reset.c
+++ b/arch/mips/loongson/common/reset.c
@@ -25,17 +25,26 @@ static void loongson_restart(char *command)
((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();
}
-static void loongson_halt(void)
+static void loongson_poweroff(void)
{
mach_prepare_shutdown();
unreachable();
}
+static void loongson_halt(void)
+{
+ pr_notice("\n\n** You can safely turn off the power now **\n\n");
+ while (1) {
+ if (cpu_wait)
+ cpu_wait();
+ }
+}
+
static int __init mips_reboot_setup(void)
{
_machine_restart = loongson_restart;
_machine_halt = loongson_halt;
- pm_power_off = loongson_halt;
+ pm_power_off = loongson_poweroff;
return 0;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -queue] Loongson: Cleanup the halt and poweroff action
2010-01-27 14:39 [PATCH -queue] Loongson: Cleanup the halt and poweroff action Wu Zhangjin
@ 2010-01-27 21:54 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2010-01-27 21:54 UTC (permalink / raw)
To: Wu Zhangjin; +Cc: Liu Shiwei, linux-mips
On Wed, Jan 27, 2010 at 10:39:46PM +0800, Wu Zhangjin wrote:
Thanks, queued for 2.6.34.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-27 21:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-27 14:39 [PATCH -queue] Loongson: Cleanup the halt and poweroff action Wu Zhangjin
2010-01-27 21:54 ` Ralf Baechle
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).