diff options
author | John Crispin <blogic@openwrt.org> | 2011-08-24 04:31:39 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2011-09-20 08:28:24 -0400 |
commit | 9cfce47b146cb492b8d5e7b40d6f7b3ea1963d50 (patch) | |
tree | 37019440c279b8fb9616c1a728f18b8a509ed50a /drivers/watchdog | |
parent | dbc018eca386b4e2670fc3116feada19f3db664c (diff) |
watchdog: lantiq: fix watchdogs timeout handling
The enable function was using the global timeout variable for local operations.
This resulted in the value of the global variable being corrupted, thus
breaking the code.
Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-mips@linux-mips.org
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/lantiq_wdt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c index 7d82adac1cb2..102aed0efbf1 100644 --- a/drivers/watchdog/lantiq_wdt.c +++ b/drivers/watchdog/lantiq_wdt.c | |||
@@ -51,16 +51,16 @@ static int ltq_wdt_ok_to_close; | |||
51 | static void | 51 | static void |
52 | ltq_wdt_enable(void) | 52 | ltq_wdt_enable(void) |
53 | { | 53 | { |
54 | ltq_wdt_timeout = ltq_wdt_timeout * | 54 | unsigned long int timeout = ltq_wdt_timeout * |
55 | (ltq_io_region_clk_rate / LTQ_WDT_DIVIDER) + 0x1000; | 55 | (ltq_io_region_clk_rate / LTQ_WDT_DIVIDER) + 0x1000; |
56 | if (ltq_wdt_timeout > LTQ_MAX_TIMEOUT) | 56 | if (timeout > LTQ_MAX_TIMEOUT) |
57 | ltq_wdt_timeout = LTQ_MAX_TIMEOUT; | 57 | timeout = LTQ_MAX_TIMEOUT; |
58 | 58 | ||
59 | /* write the first password magic */ | 59 | /* write the first password magic */ |
60 | ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR); | 60 | ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR); |
61 | /* write the second magic plus the configuration and new timeout */ | 61 | /* write the second magic plus the configuration and new timeout */ |
62 | ltq_w32(LTQ_WDT_SR_EN | LTQ_WDT_SR_PWD | LTQ_WDT_SR_CLKDIV | | 62 | ltq_w32(LTQ_WDT_SR_EN | LTQ_WDT_SR_PWD | LTQ_WDT_SR_CLKDIV | |
63 | LTQ_WDT_PW2 | ltq_wdt_timeout, ltq_wdt_membase + LTQ_WDT_CR); | 63 | LTQ_WDT_PW2 | timeout, ltq_wdt_membase + LTQ_WDT_CR); |
64 | } | 64 | } |
65 | 65 | ||
66 | static void | 66 | static void |