Skip to contentSkip to conversation

watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog

PATCH In review gundberg 3 participants 3 messages Apr 24, 2014 – May 7, 2014 Watchdog device drivers

lore
Share & tools
lore

gundberg

author
#0 lore raw

PATCH 1/1 watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog

Use the prescaler index, rather than its value, to configure the watchdog. This will prevent a mismatch with the prescaler used to calculate the cycles.

---
 drivers/watchdog/kempld_wdt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/kempld_wdt.c renamed from drivers/watchdog/kempld_wdt.c.orig +1 -1
@@ -163,7 +163,7 @@ static int kempld_wdt_set_stage_timeout(
 	kempld_get_mutex(pld);
 	stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id));
 	stage_cfg &= ~STAGE_CFG_PRESCALER_MASK;
-	stage_cfg |= STAGE_CFG_SET_PRESCALER(prescaler);
+	stage_cfg |= STAGE_CFG_SET_PRESCALER(PRESCALER_21);
 	kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->id), stage_cfg);
 	kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->id),
 			stage_timeout);
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · gundberg

Use the prescaler index, rather than its value, to configure the watchdog. This will prevent a mismatch with the prescaler used to calculate the cycles.

Good catch. Looks correct to me. Michael, any comments ?

Quoted 20 lines
---
 drivers/watchdog/kempld_wdt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/kempld_wdt.c renamed from drivers/watchdog/kempld_wdt.c.orig +1 -2
@@ -163,7 +163,7 @@ static int kempld_wdt_set_stage_timeout(
 	kempld_get_mutex(pld);
 	stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id));
 	stage_cfg &= ~STAGE_CFG_PRESCALER_MASK;
-	stage_cfg |= STAGE_CFG_SET_PRESCALER(prescaler);
+	stage_cfg |= STAGE_CFG_SET_PRESCALER(PRESCALER_21);
 	kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->id), stage_cfg);
 	kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->id),
 			stage_timeout);
--

To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to gundberg
Quoted 10 lines · Guenter Roeck
Quoted 5 lines · gundberg

Use the prescaler index, rather than its value, to configure the watchdog. This will prevent a mismatch with the prescaler used to calculate the cycles.

Good catch. Looks correct to me. Michael, any comments ?

Setting the prescaler incorrectly this way can cause the system to reboot nearly immediately when activating the watchdog - not good. This should also be applied to the stable revisions as this code is included since 3.11.

Thanks,
Michael