aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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