mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-07 00:59:06 +00:00
watchdog: softdog: 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: Damien Riegel <damien.riegel@savoirfairelinux.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Vivien Didelot <vivien.didelot@savoirlinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
28e805b44d
commit
84ebcc17f2
1 changed files with 2 additions and 28 deletions
|
@ -43,7 +43,6 @@
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
#include <linux/watchdog.h>
|
#include <linux/watchdog.h>
|
||||||
#include <linux/notifier.h>
|
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/jiffies.h>
|
#include <linux/jiffies.h>
|
||||||
|
@ -121,27 +120,10 @@ static int softdog_set_timeout(struct watchdog_device *w, unsigned int t)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Notifier for system down
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int softdog_notify_sys(struct notifier_block *this, unsigned long code,
|
|
||||||
void *unused)
|
|
||||||
{
|
|
||||||
if (code == SYS_DOWN || code == SYS_HALT)
|
|
||||||
/* Turn the WDT off */
|
|
||||||
softdog_stop(NULL);
|
|
||||||
return NOTIFY_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Kernel Interfaces
|
* Kernel Interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct notifier_block softdog_notifier = {
|
|
||||||
.notifier_call = softdog_notify_sys,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct watchdog_info softdog_info = {
|
static struct watchdog_info softdog_info = {
|
||||||
.identity = "Software Watchdog",
|
.identity = "Software Watchdog",
|
||||||
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
|
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
|
||||||
|
@ -175,18 +157,11 @@ static int __init watchdog_init(void)
|
||||||
softdog_dev.timeout = soft_margin;
|
softdog_dev.timeout = soft_margin;
|
||||||
|
|
||||||
watchdog_set_nowayout(&softdog_dev, nowayout);
|
watchdog_set_nowayout(&softdog_dev, nowayout);
|
||||||
|
watchdog_stop_on_reboot(&softdog_dev);
|
||||||
ret = register_reboot_notifier(&softdog_notifier);
|
|
||||||
if (ret) {
|
|
||||||
pr_err("cannot register reboot notifier (err=%d)\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = watchdog_register_device(&softdog_dev);
|
ret = watchdog_register_device(&softdog_dev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
unregister_reboot_notifier(&softdog_notifier);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
|
pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
|
||||||
soft_noboot, soft_margin, soft_panic, nowayout);
|
soft_noboot, soft_margin, soft_panic, nowayout);
|
||||||
|
@ -197,7 +172,6 @@ static int __init watchdog_init(void)
|
||||||
static void __exit watchdog_exit(void)
|
static void __exit watchdog_exit(void)
|
||||||
{
|
{
|
||||||
watchdog_unregister_device(&softdog_dev);
|
watchdog_unregister_device(&softdog_dev);
|
||||||
unregister_reboot_notifier(&softdog_notifier);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(watchdog_init);
|
module_init(watchdog_init);
|
||||||
|
|
Loading…
Reference in a new issue