aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/w83697hf_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/watchdog/w83697hf_wdt.c')
-rw-r--r--drivers/char/watchdog/w83697hf_wdt.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/char/watchdog/w83697hf_wdt.c b/drivers/char/watchdog/w83697hf_wdt.c
index 21052de8a0c6..7768b55487c8 100644
--- a/drivers/char/watchdog/w83697hf_wdt.c
+++ b/drivers/char/watchdog/w83697hf_wdt.c
@@ -369,33 +369,35 @@ w83697hf_check_wdt(void)
369 return -EIO; 369 return -EIO;
370} 370}
371 371
372static int w83697hf_ioports[] = { 0x2e, 0x4e, 0x00 };
373
372static int __init 374static int __init
373wdt_init(void) 375wdt_init(void)
374{ 376{
375 int ret, autodetect; 377 int ret, i, found = 0;
376 378
377 spin_lock_init(&io_lock); 379 spin_lock_init(&io_lock);
378 380
379 printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); 381 printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
380 382
381 autodetect = wdt_io == 0; 383 if (wdt_io == 0) {
382 if (autodetect) 384 /* we will autodetect the W83697HF/HG watchdog */
383 wdt_io = 0x2e; 385 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) {
384 386 wdt_io = w83697hf_ioports[i];
385 if (!w83697hf_check_wdt()) 387 if (!w83697hf_check_wdt())
386 goto found; 388 found++;
387 389 }
388 if (autodetect) { 390 } else {
389 wdt_io = 0x4e;
390 if (!w83697hf_check_wdt()) 391 if (!w83697hf_check_wdt())
391 goto found; 392 found++;
392 } 393 }
393 394
394 printk (KERN_ERR PFX "No W83697HF/HG could be found\n"); 395 if (!found) {
395 ret = -EIO; 396 printk (KERN_ERR PFX "No W83697HF/HG could be found\n");
396 goto out; 397 ret = -EIO;
398 goto out;
399 }
397 400
398found:
399 w83697hf_init(); 401 w83697hf_init();
400 wdt_disable(); /* Disable watchdog until first use */ 402 wdt_disable(); /* Disable watchdog until first use */
401 403