summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2006-09-15 17:59:07 +0200
committerWim Van Sebroeck <wim@iguana.be>2006-10-04 22:46:35 +0200
commite223f01a822e999b0aea2e720e12d8bb3532da70 (patch)
tree27286d5e673e667dfe45e931f2ba802d68a66338 /drivers
parent3fdee8db010d5cbf890ec49332ac4946f3f63720 (diff)
downloadop-kernel-dev-e223f01a822e999b0aea2e720e12d8bb3532da70.zip
op-kernel-dev-e223f01a822e999b0aea2e720e12d8bb3532da70.tar.gz
[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.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 21052de..7768b55 100644
--- a/drivers/char/watchdog/w83697hf_wdt.c
+++ b/drivers/char/watchdog/w83697hf_wdt.c
@@ -369,33 +369,35 @@ w83697hf_check_wdt(void)
return -EIO;
}
+static int w83697hf_ioports[] = { 0x2e, 0x4e, 0x00 };
+
static int __init
wdt_init(void)
{
- int ret, autodetect;
+ int ret, i, found = 0;
spin_lock_init(&io_lock);
printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
- autodetect = wdt_io == 0;
- if (autodetect)
- wdt_io = 0x2e;
-
- if (!w83697hf_check_wdt())
- goto found;
-
- if (autodetect) {
- wdt_io = 0x4e;
+ if (wdt_io == 0) {
+ /* we will autodetect the W83697HF/HG watchdog */
+ for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) {
+ wdt_io = w83697hf_ioports[i];
+ if (!w83697hf_check_wdt())
+ found++;
+ }
+ } else {
if (!w83697hf_check_wdt())
- goto found;
+ found++;
}
- printk (KERN_ERR PFX "No W83697HF/HG could be found\n");
- ret = -EIO;
- goto out;
+ if (!found) {
+ printk (KERN_ERR PFX "No W83697HF/HG could be found\n");
+ ret = -EIO;
+ goto out;
+ }
-found:
w83697hf_init();
wdt_disable(); /* Disable watchdog until first use */
OpenPOWER on IntegriCloud