0003-MIPS-lantiq-fix-watchdogs-timeout-handling.patch 1.6 KB

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