Root/target/linux/lantiq/patches-3.0/0003-MIPS-lantiq-fix-watchdogs-timeout-handling.patch

1From 14ea48a5f5702ddc97425cbe520600e187e14e4a Mon Sep 17 00:00:00 2001
2From: John Crispin <blogic@openwrt.org>
3Date: Thu, 11 Aug 2011 13:58:39 +0200
4Subject: [PATCH 03/24] MIPS: lantiq: fix watchdogs timeout handling
5
6The enable function was using the global timeout variable for local operations.
7This resulted in the value of the global variable being corrupted, thus
8breaking the code.
9
10Signed-off-by: John Crispin <blogic@openwrt.org>
11Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
12Cc: linux-watchdog@vger.kernel.org
13Cc: linux-mips@linux-mips.org
14---
15 drivers/watchdog/lantiq_wdt.c | 8 ++++----
16 1 files changed, 4 insertions(+), 4 deletions(-)
17
18diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c
19index 7d82ada..102aed0 100644
20--- a/drivers/watchdog/lantiq_wdt.c
21+++ b/drivers/watchdog/lantiq_wdt.c
22@@ -51,16 +51,16 @@ static int ltq_wdt_ok_to_close;
23 static void
24 ltq_wdt_enable(void)
25 {
26- ltq_wdt_timeout = ltq_wdt_timeout *
27+ unsigned long int timeout = ltq_wdt_timeout *
28             (ltq_io_region_clk_rate / LTQ_WDT_DIVIDER) + 0x1000;
29- if (ltq_wdt_timeout > LTQ_MAX_TIMEOUT)
30- ltq_wdt_timeout = LTQ_MAX_TIMEOUT;
31+ if (timeout > LTQ_MAX_TIMEOUT)
32+ timeout = LTQ_MAX_TIMEOUT;
33 
34     /* write the first password magic */
35     ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR);
36     /* write the second magic plus the configuration and new timeout */
37     ltq_w32(LTQ_WDT_SR_EN | LTQ_WDT_SR_PWD | LTQ_WDT_SR_CLKDIV |
38- LTQ_WDT_PW2 | ltq_wdt_timeout, ltq_wdt_membase + LTQ_WDT_CR);
39+ LTQ_WDT_PW2 | timeout, ltq_wdt_membase + LTQ_WDT_CR);
40 }
41 
42 static void
43--
441.7.5.4
45
46

Archive Download this file



interactive