diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2006-09-15 11:59:07 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2006-10-04 16:46:35 -0400 |
commit | e223f01a822e999b0aea2e720e12d8bb3532da70 (patch) | |
tree | 27286d5e673e667dfe45e931f2ba802d68a66338 /drivers | |
parent | 3fdee8db010d5cbf890ec49332ac4946f3f63720 (diff) |
[WATCHDOG] w83697hf/hg WDT driver - autodetect patch
Change the autodetect code so that it is more generic.
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/watchdog/w83697hf_wdt.c | 32 |
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 | ||
372 | static int w83697hf_ioports[] = { 0x2e, 0x4e, 0x00 }; | ||
373 | |||
372 | static int __init | 374 | static int __init |
373 | wdt_init(void) | 375 | wdt_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 | ||
398 | found: | ||
399 | w83697hf_init(); | 401 | w83697hf_init(); |
400 | wdt_disable(); /* Disable watchdog until first use */ | 402 | wdt_disable(); /* Disable watchdog until first use */ |
401 | 403 | ||