lkml.org 
[lkml]   [2014]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 09/10] power/reset: hisi: Register with kernel restart handler
Date
Register with kernel restart handler instead of setting arm_pm_restart directly.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/power/reset/hisi-reboot.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/power/reset/hisi-reboot.c b/drivers/power/reset/hisi-reboot.c
index 0c91d02..e9774b0 100644
--- a/drivers/power/reset/hisi-reboot.c
+++ b/drivers/power/reset/hisi-reboot.c
@@ -14,27 +14,36 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/module.h>
+#include <linux/notifier.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>

#include <asm/proc-fns.h>
-#include <asm/system_misc.h>

static void __iomem *base;
static u32 reboot_offset;

-static void hisi_restart(enum reboot_mode mode, const char *cmd)
+static int hisi_restart_handler(struct notifier_block *this,
+ unsigned long mode, void *cmd)
{
writel_relaxed(0xdeadbeef, base + reboot_offset);

while (1)
cpu_do_idle();
+
+ return NOTIFY_DONE;
}

+static struct notifier_block hisi_restart_nb = {
+ .notifier_call = hisi_restart_handler,
+ .priority = 128,
+};
+
static int hisi_reboot_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ int err;

base = of_iomap(np, 0);
if (!base) {
@@ -47,7 +56,10 @@ static int hisi_reboot_probe(struct platform_device *pdev)
return -EINVAL;
}

- arm_pm_restart = hisi_restart;
+ err = register_restart_handler(&hisi_restart_nb);
+ if (err)
+ dev_err(&pdev->dev, "cannot register restart handler (err=%d)\n",
+ err);

return 0;
}
--
1.9.1


\
 
 \ /
  Last update: 2014-09-27 03:21    [W:0.091 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site