Commit d68106bb authored by Damien Riegel's avatar Damien Riegel Committed by Wim Van Sebroeck

watchdog: w83627hf_wdt: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one
provided by the watchdog core.
Signed-off-by: default avatarDamien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: default avatarVivien Didelot <vivien.didelot@savoirlinux.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 84ebcc17
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -287,18 +285,6 @@ static unsigned int wdt_get_time(struct watchdog_device *wdog) ...@@ -287,18 +285,6 @@ static unsigned int wdt_get_time(struct watchdog_device *wdog)
return timeleft; return timeleft;
} }
/*
* Notifier for system down
*/
static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
if (code == SYS_DOWN || code == SYS_HALT)
wdt_set_time(0); /* Turn the WDT off */
return NOTIFY_DONE;
}
/* /*
* Kernel Interfaces * Kernel Interfaces
*/ */
...@@ -329,10 +315,6 @@ static struct watchdog_device wdt_dev = { ...@@ -329,10 +315,6 @@ static struct watchdog_device wdt_dev = {
* turn the timebomb registers off. * turn the timebomb registers off.
*/ */
static struct notifier_block wdt_notifier = {
.notifier_call = wdt_notify_sys,
};
static int wdt_find(int addr) static int wdt_find(int addr)
{ {
u8 val; u8 val;
...@@ -456,6 +438,7 @@ static int __init wdt_init(void) ...@@ -456,6 +438,7 @@ static int __init wdt_init(void)
watchdog_init_timeout(&wdt_dev, timeout, NULL); watchdog_init_timeout(&wdt_dev, timeout, NULL);
watchdog_set_nowayout(&wdt_dev, nowayout); watchdog_set_nowayout(&wdt_dev, nowayout);
watchdog_stop_on_reboot(&wdt_dev);
ret = w83627hf_init(&wdt_dev, chip); ret = w83627hf_init(&wdt_dev, chip);
if (ret) { if (ret) {
...@@ -463,30 +446,19 @@ static int __init wdt_init(void) ...@@ -463,30 +446,19 @@ static int __init wdt_init(void)
return ret; return ret;
} }
ret = register_reboot_notifier(&wdt_notifier);
if (ret != 0) {
pr_err("cannot register reboot notifier (err=%d)\n", ret);
return ret;
}
ret = watchdog_register_device(&wdt_dev); ret = watchdog_register_device(&wdt_dev);
if (ret) if (ret)
goto unreg_reboot; return ret;
pr_info("initialized. timeout=%d sec (nowayout=%d)\n", pr_info("initialized. timeout=%d sec (nowayout=%d)\n",
wdt_dev.timeout, nowayout); wdt_dev.timeout, nowayout);
return ret; return ret;
unreg_reboot:
unregister_reboot_notifier(&wdt_notifier);
return ret;
} }
static void __exit wdt_exit(void) static void __exit wdt_exit(void)
{ {
watchdog_unregister_device(&wdt_dev); watchdog_unregister_device(&wdt_dev);
unregister_reboot_notifier(&wdt_notifier);
} }
module_init(wdt_init); module_init(wdt_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment