Skip to contentSkip to conversation

i810 TCO TIMER WATCHDOG request region fix

PATCH New [email protected] 1 participant 1 message Oct 20, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i810 TCO TIMER WATCHDOG request region fix

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.

----- Message transféré de [email protected] -----
Date : Sat, 28 Aug 2004 22:33:32 +0200
De : [email protected]
Adresse de retour :[email protected]
Sujet : i810 TCO TIMER WATCHDOG resuaest region fix
À : [email protected]

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é -----

drivers/char/watchdog/i8xx_tco.c +10 -3
@@ -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;