diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 20:15:38 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 20:15:38 (GMT) |
commit | 6606b342febfd470b4a33acb73e360eeaca1d9bb (patch) | |
tree | 2414cc2ca582aa34be6e6ed5c830658fbf21db41 /drivers/watchdog/stmp3xxx_rtc_wdt.c | |
parent | a016af2e70bfca23f2f5de7d8708157b86ea374d (diff) | |
parent | ac36856fe4321454b6789c019c96c3ec854094ed (diff) | |
download | linux-6606b342febfd470b4a33acb73e360eeaca1d9bb.tar.xz |
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
"This adds following items:
- watchdog restart handler support
- watchdog reboot notifier support
- watchdog sysfs attributes
- support for the following new devices: AMD Mullins platform, AMD
Carrizo platform, meson8b SoC, CSRatlas7, TS-4800, Alphascale
asm9260-wdt, Zodiac, Sigma Designs SMP86xx/SMP87xx
- Changes in refcounting for the watchdog core
- watchdog core improvements
- and small fixes"
* git://www.linux-watchdog.org/linux-watchdog: (60 commits)
watchdog: asm9260: remove __init and __exit annotations
watchdog: Drop pointer to watchdog device from struct watchdog_device
watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes
watchdog: Add support for creating driver specific sysfs attributes
watchdog: kill unref/ref ops
watchdog: stmp3xxx: Remove unused variables
watchdog: add MT7621 watchdog support
hwmon: (sch56xx) Drop watchdog driver data reference count callbacks
watchdog: da9055_wdt: Drop reference counting
watchdog: da9052_wdt: Drop reference counting
watchdog: Separate and maintain variables based on variable lifetime
watchdog: diag288: Stop re-using watchdog core internal flags
watchdog: Create watchdog device in watchdog_dev.c
watchdog: qcom-wdt: Do not set 'dev' in struct watchdog_device
watchdog: mena21: Do not use device pointer from struct watchdog_device
watchdog: gpio: Do not use device pointer from struct watchdog_device
watchdog: tangox: Print info message using pointer to platform device
watchdog: bcm2835_wdt: Drop log message if watchdog is stopped
devicetree: watchdog: add binding for Sigma Designs SMP8642 watchdog
watchdog: add support for Sigma Designs SMP86xx/SMP87xx
...
Diffstat (limited to 'drivers/watchdog/stmp3xxx_rtc_wdt.c')
-rw-r--r-- | drivers/watchdog/stmp3xxx_rtc_wdt.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/watchdog/stmp3xxx_rtc_wdt.c b/drivers/watchdog/stmp3xxx_rtc_wdt.c index 3ee6128..d8b11eb 100644 --- a/drivers/watchdog/stmp3xxx_rtc_wdt.c +++ b/drivers/watchdog/stmp3xxx_rtc_wdt.c @@ -14,6 +14,8 @@ #include <linux/watchdog.h> #include <linux/platform_device.h> #include <linux/stmp3xxx_rtc_wdt.h> +#include <linux/notifier.h> +#include <linux/reboot.h> #define WDOG_TICK_RATE 1000 /* 1 kHz clock */ #define STMP3XXX_DEFAULT_TIMEOUT 19 @@ -69,6 +71,25 @@ static struct watchdog_device stmp3xxx_wdd = { .status = WATCHDOG_NOWAYOUT_INIT_STATUS, }; +static int wdt_notify_sys(struct notifier_block *nb, unsigned long code, + void *unused) +{ + switch (code) { + case SYS_DOWN: /* keep enabled, system might crash while going down */ + break; + case SYS_HALT: /* allow the system to actually halt */ + case SYS_POWER_OFF: + wdt_stop(&stmp3xxx_wdd); + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block wdt_notifier = { + .notifier_call = wdt_notify_sys, +}; + static int stmp3xxx_wdt_probe(struct platform_device *pdev) { int ret; @@ -84,6 +105,9 @@ static int stmp3xxx_wdt_probe(struct platform_device *pdev) return ret; } + if (register_reboot_notifier(&wdt_notifier)) + dev_warn(&pdev->dev, "cannot register reboot notifier\n"); + dev_info(&pdev->dev, "initialized watchdog with heartbeat %ds\n", stmp3xxx_wdd.timeout); return 0; @@ -91,6 +115,7 @@ static int stmp3xxx_wdt_probe(struct platform_device *pdev) static int stmp3xxx_wdt_remove(struct platform_device *pdev) { + unregister_reboot_notifier(&wdt_notifier); watchdog_unregister_device(&stmp3xxx_wdd); return 0; } |