From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Liu Shiwei <liushiwei@gmail.com>,
Wu Zhangjin <wuzhangjin@gmail.com>,
linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH -queue] Loongson: Cleanup the halt and poweroff action
Date: Wed, 27 Jan 2010 22:39:46 +0800 [thread overview]
Message-ID: <1264603186.21973.0.camel@falcon> (raw)
(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
next reply other threads:[~2010-01-27 14:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 14:39 Wu Zhangjin [this message]
2010-01-27 21:54 ` [PATCH -queue] Loongson: Cleanup the halt and poweroff action Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1264603186.21973.0.camel@falcon \
--to=wuzhangjin@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=liushiwei@gmail.com \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).