aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2006-09-07 05:57:00 -0400
committerWim Van Sebroeck <wim@iguana.be>2006-10-04 16:45:42 -0400
commit089d8139f4c19c2f4d6984323e9d8a6e77cc92f7 (patch)
tree295268713f0da29a1bba5361a466042398abca51
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>
-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 b3dcc81abbbc..2b3ce434c196 100644
--- a/drivers/char/watchdog/w83697hf_wdt.c
+++ b/drivers/char/watchdog/w83697hf_wdt.c
@@ -156,31 +156,44 @@ w83697hf_init(void)
156 w83697hf_unselect_wd_register(); 156 w83697hf_unselect_wd_register();
157} 157}
158 158
159static void 159static int
160wdt_ctrl(int timeout) 160wdt_ping(void)
161{ 161{
162 spin_lock(&io_lock); 162 spin_lock(&io_lock);
163
164 w83697hf_select_wdt(); 163 w83697hf_select_wdt();
165 164
166 w83697hf_write_timeout(timeout); 165 w83697hf_write_timeout(timeout);
167 166
168 w83697hf_deselect_wdt(); 167 w83697hf_deselect_wdt();
169
170 spin_unlock(&io_lock); 168 spin_unlock(&io_lock);
169 return 0;
171} 170}
172 171
173static int 172static int
174wdt_ping(void) 173wdt_enable(void)
175{ 174{
176 wdt_ctrl(timeout); 175 spin_lock(&io_lock);
176 w83697hf_select_wdt();
177
178 w83697hf_write_timeout(timeout);
179 w83697hf_set_reg(0x30, 1); /* Enable timer */
180
181 w83697hf_deselect_wdt();
182 spin_unlock(&io_lock);
177 return 0; 183 return 0;
178} 184}
179 185
180static int 186static int
181wdt_disable(void) 187wdt_disable(void)
182{ 188{
183 wdt_ctrl(0); 189 spin_lock(&io_lock);
190 w83697hf_select_wdt();
191
192 w83697hf_set_reg(0x30, 0); /* Disable timer */
193 w83697hf_write_timeout(0);
194
195 w83697hf_deselect_wdt();
196 spin_unlock(&io_lock);
184 return 0; 197 return 0;
185} 198}
186 199
@@ -267,7 +280,7 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
267 } 280 }
268 281
269 if (options & WDIOS_ENABLECARD) { 282 if (options & WDIOS_ENABLECARD) {
270 wdt_ping(); 283 wdt_enable();
271 retval = 0; 284 retval = 0;
272 } 285 }
273 286
@@ -289,7 +302,7 @@ wdt_open(struct inode *inode, struct file *file)
289 * Activate 302 * Activate
290 */ 303 */
291 304
292 wdt_ping(); 305 wdt_enable();
293 return nonseekable_open(inode, file); 306 return nonseekable_open(inode, file);
294} 307}
295 308