fw :[patch] i810 TCO TIMER WATCHDOG request region fix

From: castet . matthieu
Date: Wed Oct 20 2004 - 23:41:54 EST


Hi,
I sent this patch more than 1 month ago to the i810 tco maintainer. Since I have
no reply, I forward it to the lkml.

Signed-off-by: Matthieu CASTET <castet.matthieu@xxxxxxx>

----- Message transféré de castet.matthieu@xxxxxxx -----
Date : Sat, 28 Aug 2004 22:33:32 +0200
De : castet.matthieu@xxxxxxx
Adresse de retour :castet.matthieu@xxxxxxx
Sujet : i810 TCO TIMER WATCHDOG resuaest region fix
À : nils@xxxxxxxxxxxxxxxxx

Hello,
in i8xx_tco.c, during the initialisation, the driver make io without checking if
the port is free.

Patch attach.

Thanks

Matthieu
----- Fin du message transféré -----


--- linux-2.6.7o/drivers/char/watchdog/i8xx_tco.c 2004-08-22 21:35:16.000000000 +0200
+++ linux-2.6.7/drivers/char/watchdog/i8xx_tco.c 2004-08-22 22:04:36.000000000 +0200
@@ -415,12 +416,15 @@
}
}
/* Set the TCO_EN bit in SMI_EN register */
+ if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) {
+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+ SMI_EN + 1);
+ return 0;
+ }
val1 = inb (SMI_EN + 1);
val1 &= 0xdf;
outb (val1, SMI_EN + 1);
- /* Clear out the (probably old) status */
- outb (0, TCO1_STS);
- outb (3, TCO2_STS);
+ release_region (SMI_EN + 1, 1);
return 1;
}
return 0;
@@ -443,6 +447,10 @@
goto out;
}

+ /* Clear out the (probably old) status */
+ outb (0, TCO1_STS);
+ outb (3, TCO2_STS);
+
/* Check that the heartbeat value is within it's range ; if not reset to the default */
if (tco_timer_set_heartbeat (heartbeat)) {
heartbeat = WATCHDOG_HEARTBEAT;