Commit 726c9f611a4079b5265e7ede1d66ed455ac6343c
1 parent
c0ead7e0ff
Exists in
master
and in
7 other branches
[WATCHDOG] at32ap700x_wdt.c - timeout module parameter patch
integrate the timeout/heartbeat as a module parameter and not as a CONFIG_* value. Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Cc: Andrew Morton <akpm@linux-foundation.org>
Showing 2 changed files with 13 additions and 16 deletions Side-by-side Diff
drivers/char/watchdog/Kconfig
... | ... | @@ -196,17 +196,6 @@ |
196 | 196 | Watchdog timer embedded into AT32AP700x devices. This will reboot |
197 | 197 | your system when the timeout is reached. |
198 | 198 | |
199 | -config AT32AP700X_WDT_TIMEOUT | |
200 | - int "Timeout value for AT32AP700x watchdog" | |
201 | - depends on AT32AP700X_WDT | |
202 | - default "2" | |
203 | - range 1 2 | |
204 | - help | |
205 | - Sets the timeout value for the watchdog in AT32AP700x devices. | |
206 | - Limited by hardware to be 1 or 2 seconds. | |
207 | - | |
208 | - Set to 2 seconds by default. | |
209 | - | |
210 | 199 | # X86 (i386 + ia64 + x86_64) Architecture |
211 | 200 | |
212 | 201 | config ACQUIRE_WDT |
drivers/char/watchdog/at32ap700x_wdt.c
... | ... | @@ -20,9 +20,16 @@ |
20 | 20 | #include <linux/io.h> |
21 | 21 | |
22 | 22 | #define TIMEOUT_MIN 1 |
23 | -#define TIMEOUT_DEFAULT CONFIG_AT32AP700X_WDT_TIMEOUT | |
24 | 23 | #define TIMEOUT_MAX 2 |
24 | +#define TIMEOUT_DEFAULT TIMEOUT_MAX | |
25 | 25 | |
26 | +/* module parameters */ | |
27 | +static int timeout = TIMEOUT_DEFAULT; | |
28 | +module_param(timeout, int, 0); | |
29 | +MODULE_PARM_DESC(timeout, | |
30 | + "Timeout value. Limited to be 1 or 2 seconds. (default=" | |
31 | + __MODULE_STRING(TIMEOUT_DEFAULT) ")"); | |
32 | + | |
26 | 33 | /* Watchdog registers and write/read macro */ |
27 | 34 | #define WDT_CTRL 0x00 |
28 | 35 | #define WDT_CTRL_EN 0 |
29 | 36 | |
... | ... | @@ -233,11 +240,11 @@ |
233 | 240 | wdt->miscdev.name = "watchdog"; |
234 | 241 | wdt->miscdev.fops = &at32_wdt_fops; |
235 | 242 | |
236 | - if (at32_wdt_settimeout(TIMEOUT_DEFAULT)) { | |
237 | - at32_wdt_settimeout(TIMEOUT_MAX); | |
243 | + if (at32_wdt_settimeout(timeout)) { | |
244 | + at32_wdt_settimeout(TIMEOUT_DEFAULT); | |
238 | 245 | dev_dbg(&pdev->dev, |
239 | 246 | "default timeout invalid, set to %d sec.\n", |
240 | - TIMEOUT_MAX); | |
247 | + TIMEOUT_DEFAULT); | |
241 | 248 | } |
242 | 249 | |
243 | 250 | ret = misc_register(&wdt->miscdev); |
... | ... | @@ -248,7 +255,8 @@ |
248 | 255 | |
249 | 256 | platform_set_drvdata(pdev, wdt); |
250 | 257 | wdt->miscdev.parent = &pdev->dev; |
251 | - dev_info(&pdev->dev, "AT32AP700X WDT at 0x%p\n", wdt->regs); | |
258 | + dev_info(&pdev->dev, "AT32AP700X WDT at 0x%p, timeout %d sec\n", | |
259 | + wdt->regs, wdt->timeout); | |
252 | 260 | |
253 | 261 | return 0; |
254 | 262 |