From: Guenter Roeck <linux@roeck-us.net>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
David Woodhouse <dwmw2@infradead.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/6] power/reset: st-poweroff: Register with kernel restart handler
Date: Sun, 25 Jan 2015 12:30:43 -0800 [thread overview]
Message-ID: <1422217845-18901-5-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1422217845-18901-1-git-send-email-linux@roeck-us.net>
Register with kernel restart handler instead of setting arm_pm_restart
directly. Select high priority since the restart handler is instantiated
through devicetree, indicating that it should be used if configured.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/st-poweroff.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/power/reset/st-poweroff.c b/drivers/power/reset/st-poweroff.c
index a0acf25..27383de 100644
--- a/drivers/power/reset/st-poweroff.c
+++ b/drivers/power/reset/st-poweroff.c
@@ -15,10 +15,9 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/mfd/syscon.h>
+#include <linux/reboot.h>
#include <linux/regmap.h>
-#include <asm/system_misc.h>
-
struct reset_syscfg {
struct regmap *regmap;
/* syscfg used for reset */
@@ -75,7 +74,8 @@ static struct reset_syscfg stid127_reset = {
static struct reset_syscfg *st_restart_syscfg;
-static void st_restart(enum reboot_mode reboot_mode, const char *cmd)
+static int st_restart(struct notifier_block *this, unsigned long mode,
+ void *cmd)
{
/* reset syscfg updated */
regmap_update_bits(st_restart_syscfg->regmap,
@@ -88,8 +88,15 @@ static void st_restart(enum reboot_mode reboot_mode, const char *cmd)
st_restart_syscfg->offset_rst_msk,
st_restart_syscfg->mask_rst_msk,
0);
+
+ return NOTIFY_DONE;
}
+static struct notifier_block st_restart_nb = {
+ .notifier_call = st_restart,
+ .priority = 192,
+};
+
static struct of_device_id st_reset_of_match[] = {
{
.compatible = "st,stih415-restart",
@@ -126,9 +133,7 @@ static int st_reset_probe(struct platform_device *pdev)
return PTR_ERR(st_restart_syscfg->regmap);
}
- arm_pm_restart = st_restart;
-
- return 0;
+ return register_restart_handler(&st_restart_nb);
}
static struct platform_driver st_reset_driver = {
--
2.1.0
next prev parent reply other threads:[~2015-01-25 20:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-25 20:30 [PATCH v2 0/6] power/reset: restart handler patch series Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 1/6] power/reset: arm-versatile: Register with kernel restart handler Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 2/6] power/reset: at91: " Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 3/6] power/reset: Remove sun6i reboot driver Guenter Roeck
2015-01-25 20:30 ` Guenter Roeck [this message]
2015-01-25 20:30 ` [PATCH v2 5/6] power/reset: st-poweroff: Fix misleading Kconfig description Guenter Roeck
2015-01-25 20:30 ` [PATCH v2 6/6] power/reset: restart-poweroff: Remove arm dependencies Guenter Roeck
2015-01-25 21:44 ` [PATCH v2 0/6] power/reset: restart handler patch series Sebastian Reichel
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=1422217845-18901-5-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.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).