aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2006-09-07 11:57:00 +0200
committerWim Van Sebroeck <wim@iguana.be>2006-10-04 22:45:42 +0200
commit089d8139f4c19c2f4d6984323e9d8a6e77cc92f7 (patch)
tree295268713f0da29a1bba5361a466042398abca51 /drivers
parentd46ab596e251e35a7e27c95e4e4d01921f3e579e (diff)
[WATCHDOG] w83697hf/hg WDT driver - patch 13
This is patch 13 in the series of patches that converts Marcus Junker's w83697hf watchdog driver to Samuel Tardieau's w83697hf/hg watchdog driver. This patch contains following changes: - Remove wdt_ctrl (it has been replaced with the w83697hf_write_timeout() function) and redo/clean-up the start/stop/ping code. - Make sure that the watchdog is enabled or disabled When starting or stoping the device (with a call to w83697hf_set_reg(0x30, ?); ). Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/watchdog/w83697hf_wdt.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/char/watchdog/w83697hf_wdt.c b/drivers/char/watchdog/w83697hf_wdt.c
index b3dcc81abbb..2b3ce434c19 100644
--- a/drivers/char/watchdog/w83697hf_wdt.c
+++ b/drivers/char/watchdog/w83697hf_wdt.c
@@ -156,31 +156,44 @@ w83697hf_init(void)
w83697hf_unselect_wd_register();
}
-static void
-wdt_ctrl(int timeout)
+static int
+wdt_ping(void)
{
spin_lock(&io_lock);
-
w83697hf_select_wdt();
w83697hf_write_timeout(timeout);
w83697hf_deselect_wdt();
-
spin_unlock(&io_lock);
+ return 0;
}
static int
-wdt_ping(void)
+wdt_enable(void)
{
- wdt_ctrl(timeout);
+ spin_lock(&io_lock);
+ w83697hf_select_wdt();
+
+ w83697hf_write_timeout(timeout);
+ w83697hf_set_reg(0x30, 1); /* Enable timer */
+
+ w83697hf_deselect_wdt();
+ spin_unlock(&io_lock);
return 0;
}
static int
wdt_disable(void)
{
- wdt_ctrl(0);
+ spin_lock(&io_lock);
+ w83697hf_select_wdt();
+
+ w83697hf_set_reg(0x30, 0); /* Disable timer */
+ w83697hf_write_timeout(0);
+
+ w83697hf_deselect_wdt();
+ spin_unlock(&io_lock);
return 0;
}
@@ -267,7 +280,7 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
if (options & WDIOS_ENABLECARD) {
- wdt_ping();
+ wdt_enable();
retval = 0;
}
@@ -289,7 +302,7 @@ wdt_open(struct inode *inode, struct file *file)
* Activate
*/
- wdt_ping();
+ wdt_enable();
return nonseekable_open(inode, file);
}