Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97312
b: refs/heads/master
c: 6fd6560
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Tardieu authored and Wim Van Sebroeck committed May 25, 2008
1 parent 748830a commit 50772d8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5794a9f412676ee7ec87828a926d0f58f0a2ffbf
refs/heads/master: 6fd656012bb8d5c5a4570adc2e630668b0109cb0
27 changes: 26 additions & 1 deletion trunk/drivers/watchdog/w83697hf_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -62,6 +63,10 @@ static int nowayout = WATCHDOG_NOWAYOUT;
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.
*/
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 50772d8

Please sign in to comment.