qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Havard Skinnemoen via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
	Avi.Fishman@nuvoton.com,  kfting@nuvoton.com, f4bug@amsat.org,
	clg@kaod.org,  Havard Skinnemoen <hskinnemoen@google.com>
Subject: [PATCH 2/6] Move npcm7xx_timer_reached_zero call out of npcm7xx_timer_pause
Date: Thu,  8 Oct 2020 16:21:50 -0700	[thread overview]
Message-ID: <20201008232154.94221-3-hskinnemoen@google.com> (raw)
In-Reply-To: <20201008232154.94221-1-hskinnemoen@google.com>

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(-)

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);
+            }
         }
     }
 }
-- 
2.28.0.1011.ga647a8990f-goog



  parent reply	other threads:[~2020-10-08 23:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 23:21 [PATCH 0/6] Additional NPCM7xx features, devices and tests Havard Skinnemoen via
2020-10-08 23:21 ` [PATCH 1/6] tests/qtest: Add npcm7xx timer test Havard Skinnemoen via
2020-10-08 23:21 ` Havard Skinnemoen via [this message]
2020-10-19 16:00   ` [PATCH 2/6] Move npcm7xx_timer_reached_zero call out of npcm7xx_timer_pause Philippe Mathieu-Daudé
2020-10-08 23:21 ` [PATCH 3/6] hw/timer: Adding watchdog for NPCM7XX Timer Havard Skinnemoen via
2020-10-20 12:55   ` Peter Maydell
2020-10-08 23:21 ` [PATCH 4/6] hw/misc: Add npcm7xx random number generator Havard Skinnemoen via
2020-10-20 13:02   ` Peter Maydell
2020-10-20 23:40     ` Havard Skinnemoen
2020-10-08 23:21 ` [PATCH 5/6] hw/arm/npcm7xx: Add EHCI and OHCI controllers Havard Skinnemoen via
2020-10-13  7:05   ` Gerd Hoffmann
2020-10-08 23:21 ` [PATCH 6/6] hw/gpio: Add GPIO model for Nuvoton NPCM7xx Havard Skinnemoen via
2020-10-20 13:07   ` Peter Maydell
2020-10-20 13:12 ` [PATCH 0/6] Additional NPCM7xx features, devices and tests Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201008232154.94221-3-hskinnemoen@google.com \
    --to=qemu-devel@nongnu.org \
    --cc=Avi.Fishman@nuvoton.com \
    --cc=clg@kaod.org \
    --cc=f4bug@amsat.org \
    --cc=hskinnemoen@google.com \
    --cc=kfting@nuvoton.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).