aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/watchdog/watchdog-kernel-api.txt10
-rw-r--r--drivers/watchdog/s3c2410_wdt.c2
-rw-r--r--drivers/watchdog/wm831x_wdt.c4
-rw-r--r--include/linux/watchdog.h21
4 files changed, 28 insertions, 9 deletions
diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt
index 4f7c894244d2..4b93c28e35c6 100644
--- a/Documentation/watchdog/watchdog-kernel-api.txt
+++ b/Documentation/watchdog/watchdog-kernel-api.txt
@@ -1,6 +1,6 @@
1The Linux WatchDog Timer Driver Core kernel API. 1The Linux WatchDog Timer Driver Core kernel API.
2=============================================== 2===============================================
3Last reviewed: 22-Jul-2011 3Last reviewed: 29-Nov-2011
4 4
5Wim Van Sebroeck <wim@iguana.be> 5Wim Van Sebroeck <wim@iguana.be>
6 6
@@ -142,6 +142,14 @@ bit-operations. The status bits that are defined are:
142* WDOG_NO_WAY_OUT: this bit stores the nowayout setting for the watchdog. 142* WDOG_NO_WAY_OUT: this bit stores the nowayout setting for the watchdog.
143 If this bit is set then the watchdog timer will not be able to stop. 143 If this bit is set then the watchdog timer will not be able to stop.
144 144
145 To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog
146 timer device) you can either:
147 * set it statically in your watchdog_device struct with
148 .status = WATCHDOG_NOWAYOUT_INIT_STATUS,
149 (this will set the value the same as CONFIG_WATCHDOG_NOWAYOUT) or
150 * use the following helper function:
151 static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
152
145Note: The WatchDog Timer Driver Core supports the magic close feature and 153Note: The WatchDog Timer Driver Core supports the magic close feature and
146the nowayout feature. To use the magic close feature you must set the 154the nowayout feature. To use the magic close feature you must set the
147WDIOF_MAGICCLOSE bit in the options field of the watchdog's info structure. 155WDIOF_MAGICCLOSE bit in the options field of the watchdog's info structure.
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index a79e3840782a..4bc3744e14e4 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -378,6 +378,8 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
378 "cannot start\n"); 378 "cannot start\n");
379 } 379 }
380 380
381 watchdog_set_nowayout(&s3c2410_wdd, nowayout);
382
381 ret = watchdog_register_device(&s3c2410_wdd); 383 ret = watchdog_register_device(&s3c2410_wdd);
382 if (ret) { 384 if (ret) {
383 dev_err(dev, "cannot register watchdog (%d)\n", ret); 385 dev_err(dev, "cannot register watchdog (%d)\n", ret);
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c
index beb3ad2294d3..6cd1ba41b47c 100644
--- a/drivers/watchdog/wm831x_wdt.c
+++ b/drivers/watchdog/wm831x_wdt.c
@@ -213,11 +213,9 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
213 213
214 wm831x_wdt->info = &wm831x_wdt_info; 214 wm831x_wdt->info = &wm831x_wdt_info;
215 wm831x_wdt->ops = &wm831x_wdt_ops; 215 wm831x_wdt->ops = &wm831x_wdt_ops;
216 watchdog_set_nowayout(wm831x_wdt, nowayout);
216 watchdog_set_drvdata(wm831x_wdt, driver_data); 217 watchdog_set_drvdata(wm831x_wdt, driver_data);
217 218
218 if (nowayout)
219 wm831x_wdt->status |= WDOG_NO_WAY_OUT;
220
221 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG); 219 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
222 reg &= WM831X_WDOG_TO_MASK; 220 reg &= WM831X_WDOG_TO_MASK;
223 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++) 221 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 111843f88b2a..43ba5b3ce2a3 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -53,11 +53,7 @@ struct watchdog_info {
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#ifdef CONFIG_WATCHDOG_NOWAYOUT 56#include <linux/bitops.h>
57#define WATCHDOG_NOWAYOUT 1
58#else
59#define WATCHDOG_NOWAYOUT 0
60#endif
61 57
62struct watchdog_ops; 58struct watchdog_ops;
63struct watchdog_device; 59struct watchdog_device;
@@ -122,6 +118,21 @@ struct watchdog_device {
122#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ 118#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
123}; 119};
124 120
121#ifdef CONFIG_WATCHDOG_NOWAYOUT
122#define WATCHDOG_NOWAYOUT 1
123#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
124#else
125#define WATCHDOG_NOWAYOUT 0
126#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
127#endif
128
129/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
131{
132 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
134}
135
125/* Use the following functions to manipulate watchdog driver specific data */ 136/* Use the following functions to manipulate watchdog driver specific data */
126static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 137static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
127{ 138{