diff mbox series

[2/6] Move npcm7xx_timer_reached_zero call out of npcm7xx_timer_pause

Message ID 20201008232154.94221-3-hskinnemoen@google.com
State Superseded
Headers show
Series Additional NPCM7xx features, devices and tests | expand

Commit Message

Gonglei (Arei)" via Oct. 8, 2020, 11:21 p.m. UTC
This allows us to reuse npcm7xx_timer_pause for the watchdog timer.

Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
---
 hw/timer/npcm7xx_timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 19, 2020, 4 p.m. UTC | #1
On 10/9/20 1:21 AM, Havard Skinnemoen via wrote:
> This allows us to reuse npcm7xx_timer_pause for the watchdog timer.

> 

> Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>

> ---

>   hw/timer/npcm7xx_timer.c | 6 +++---

>   1 file changed, 3 insertions(+), 3 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/hw/timer/npcm7xx_timer.c b/hw/timer/npcm7xx_timer.c
index 5703e43d40..2df9e3e496 100644
--- a/hw/timer/npcm7xx_timer.c
+++ b/hw/timer/npcm7xx_timer.c
@@ -157,9 +157,6 @@  static void npcm7xx_timer_pause(NPCM7xxTimer *t)
     timer_del(&t->qtimer);
     now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
     t->remaining_ns = t->expires_ns - now;
-    if (t->remaining_ns <= 0) {
-        npcm7xx_timer_reached_zero(t);
-    }
 }
 
 /*
@@ -239,6 +236,9 @@  static void npcm7xx_timer_write_tcsr(NPCM7xxTimer *t, uint32_t new_tcsr)
         } else {
             t->tcsr &= ~NPCM7XX_TCSR_CACT;
             npcm7xx_timer_pause(t);
+            if (t->remaining_ns <= 0) {
+                npcm7xx_timer_reached_zero(t);
+            }
         }
     }
 }