* w83697hf_wdt.c cleanup and new option @ 2008-03-12 13:28 Samuel Tardieu 2008-03-12 13:28 ` [PATCH 1/3] watchdog: Make w83697h_wdt void-like functions void Samuel Tardieu 0 siblings, 1 reply; 4+ messages in thread From: Samuel Tardieu @ 2008-03-12 13:28 UTC (permalink / raw) To: linux-kernel, wim; +Cc: P [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 151 bytes --] The first two patches in the series do some cleanup, while the third one adds an early_disable option (on by default) as requested by Pádraig Brady. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] watchdog: Make w83697h_wdt void-like functions void 2008-03-12 13:28 w83697hf_wdt.c cleanup and new option Samuel Tardieu @ 2008-03-12 13:28 ` Samuel Tardieu 2008-03-12 13:28 ` [PATCH 2/3] watchdog: Make w83697h_wdt timeout option string similar to others Samuel Tardieu 0 siblings, 1 reply; 4+ messages in thread From: Samuel Tardieu @ 2008-03-12 13:28 UTC (permalink / raw) To: linux-kernel, wim; +Cc: P, Samuel Tardieu Some non-exported functions always returned 0. Mark them void instead. Signed-off-by: Samuel Tardieu <sam@rfc1149.net> --- drivers/watchdog/w83697hf_wdt.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index c622a0e..b534174 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c @@ -140,7 +140,7 @@ w83697hf_init(void) w83697hf_deselect_wdt(); } -static int +static void wdt_ping(void) { spin_lock(&io_lock); @@ -150,10 +150,9 @@ wdt_ping(void) w83697hf_deselect_wdt(); spin_unlock(&io_lock); - return 0; } -static int +static void wdt_enable(void) { spin_lock(&io_lock); @@ -164,10 +163,9 @@ wdt_enable(void) w83697hf_deselect_wdt(); spin_unlock(&io_lock); - return 0; } -static int +static void wdt_disable(void) { spin_lock(&io_lock); @@ -178,7 +176,6 @@ wdt_disable(void) w83697hf_deselect_wdt(); spin_unlock(&io_lock); - return 0; } static int -- 1.5.4.3.611.g29c00.dirty ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] watchdog: Make w83697h_wdt timeout option string similar to others 2008-03-12 13:28 ` [PATCH 1/3] watchdog: Make w83697h_wdt void-like functions void Samuel Tardieu @ 2008-03-12 13:28 ` Samuel Tardieu 2008-03-12 13:28 ` [PATCH 3/3] watchdog: Add w83697h_wdt early_disable option Samuel Tardieu 0 siblings, 1 reply; 4+ messages in thread From: Samuel Tardieu @ 2008-03-12 13:28 UTC (permalink / raw) To: linux-kernel, wim; +Cc: P, Samuel Tardieu Signed-off-by: Samuel Tardieu <sam@rfc1149.net> --- drivers/watchdog/w83697hf_wdt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index b534174..2120702 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c @@ -56,7 +56,7 @@ module_param(timeout, int, 0); static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ module_param(timeout, int, 0); -MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); +MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); static int nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, int, 0); -- 1.5.4.3.611.g29c00.dirty ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] watchdog: Add w83697h_wdt early_disable option 2008-03-12 13:28 ` [PATCH 2/3] watchdog: Make w83697h_wdt timeout option string similar to others Samuel Tardieu @ 2008-03-12 13:28 ` Samuel Tardieu 0 siblings, 0 replies; 4+ messages in thread From: Samuel Tardieu @ 2008-03-12 13:28 UTC (permalink / raw) To: linux-kernel, wim; +Cc: P, Samuel Tardieu [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2162 bytes --] Pádraig Brady requested the possibility of not disabling the watchdog at module load time or kernel boot time if it had been previously enabled in the bios. It may help rebooting the machine if it freezes before the userland daemon kicks in. Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Cc: Pádraig Brady <P@draigBrady.com> --- drivers/watchdog/w83697hf_wdt.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index 2120702..528b882 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c @@ -44,6 +44,7 @@ #define WATCHDOG_NAME "w83697hf/hg WDT" #define PFX WATCHDOG_NAME ": " #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ +#define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ static unsigned long wdt_is_open; static char expect_close; @@ -62,6 +63,10 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _ module_param(nowayout, int, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); +static int early_disable = WATCHDOG_EARLY_DISABLE; +module_param(early_disable, int, 0); +MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")"); + /* * Kernel methods. */ @@ -178,6 +183,22 @@ wdt_disable(void) spin_unlock(&io_lock); } +static unsigned char +wdt_running(void) +{ + unsigned char t; + + spin_lock(&io_lock); + w83697hf_select_wdt(); + + t = w83697hf_get_reg(0xF4); /* Read timer */ + + w83697hf_deselect_wdt(); + spin_unlock(&io_lock); + + return t; +} + static int wdt_set_heartbeat(int t) { @@ -394,7 +415,11 @@ wdt_init(void) } w83697hf_init(); - wdt_disable(); /* Disable watchdog until first use */ + if (early_disable) { + if (wdt_running()) + printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n"); + wdt_disable(); + } if (wdt_set_heartbeat(timeout)) { wdt_set_heartbeat(WATCHDOG_TIMEOUT); -- 1.5.4.3.611.g29c00.dirty ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-12 20:35 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-03-12 13:28 w83697hf_wdt.c cleanup and new option Samuel Tardieu 2008-03-12 13:28 ` [PATCH 1/3] watchdog: Make w83697h_wdt void-like functions void Samuel Tardieu 2008-03-12 13:28 ` [PATCH 2/3] watchdog: Make w83697h_wdt timeout option string similar to others Samuel Tardieu 2008-03-12 13:28 ` [PATCH 3/3] watchdog: Add w83697h_wdt early_disable option Samuel Tardieu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®