1 From 823769d2e6622a48276bee35b2dad5ba77cbdc25 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Sun, 25 Jan 2015 11:40:57 +0100
4 Subject: [PATCH] watchdog: bcm47xx_wdt.c: add restart handler support
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Just like in case of other watchdog drivers, use the new kernel core
10 API to provide restart support.
12 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
13 Reviewed-by: Guenter Roeck <linux@roeck-us.net>
14 Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
16 drivers/watchdog/bcm47xx_wdt.c | 21 ++++++++++++++++++++-
17 include/linux/bcm47xx_wdt.h | 1 +
18 2 files changed, 21 insertions(+), 1 deletion(-)
20 diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
21 index 9816485..b28a072 100644
22 --- a/drivers/watchdog/bcm47xx_wdt.c
23 +++ b/drivers/watchdog/bcm47xx_wdt.c
24 @@ -169,6 +169,17 @@ static int bcm47xx_wdt_notify_sys(struct notifier_block *this,
28 +static int bcm47xx_wdt_restart(struct notifier_block *this, unsigned long mode,
31 + struct bcm47xx_wdt *wdt;
33 + wdt = container_of(this, struct bcm47xx_wdt, restart_handler);
34 + wdt->timer_set(wdt, 1);
39 static struct watchdog_ops bcm47xx_wdt_soft_ops = {
41 .start = bcm47xx_wdt_soft_start,
42 @@ -209,15 +220,23 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)
46 - ret = watchdog_register_device(&wdt->wdd);
47 + wdt->restart_handler.notifier_call = &bcm47xx_wdt_restart;
48 + wdt->restart_handler.priority = 64;
49 + ret = register_restart_handler(&wdt->restart_handler);
53 + ret = watchdog_register_device(&wdt->wdd);
57 dev_info(&pdev->dev, "BCM47xx Watchdog Timer enabled (%d seconds%s%s)\n",
58 timeout, nowayout ? ", nowayout" : "",
59 soft ? ", Software Timer" : "");
63 + unregister_restart_handler(&wdt->restart_handler);
65 unregister_reboot_notifier(&wdt->notifier);
67 diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h
68 index b708786..5582c21 100644
69 --- a/include/linux/bcm47xx_wdt.h
70 +++ b/include/linux/bcm47xx_wdt.h
71 @@ -16,6 +16,7 @@ struct bcm47xx_wdt {
73 struct watchdog_device wdd;
74 struct notifier_block notifier;
75 + struct notifier_block restart_handler;
77 struct timer_list soft_timer;