All of lore.kernel.org
 help / color / mirror / Atom feed
From: Havard Skinnemoen via <qemu-devel@nongnu.org>
To: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Avi.Fishman@nuvoton.com, kfting@nuvoton.com, venture@google.com,
	wuhaotsh@google.com, thuth@redhat.com,
	"Havard Skinnemoen" <hskinnemoen@google.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v3 2/6] Move npcm7xx_timer_reached_zero call out of npcm7xx_timer_pause
Date: Fri, 23 Oct 2020 14:06:33 -0700	[thread overview]
Message-ID: <20201023210637.351238-3-hskinnemoen@google.com> (raw)
In-Reply-To: <20201023210637.351238-1-hskinnemoen@google.com>

This allows us to reuse npcm7xx_timer_pause for the watchdog timer.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
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.29.0.rc1.297.gfa9743e501-goog



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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 21:06 [PATCH v3 0/6] Additional NPCM7xx features, devices and tests Havard Skinnemoen via
2020-10-23 21:06 ` [PATCH v3 1/6] tests/qtest: Make npcm7xx_timer-test conditional on CONFIG_NPCM7XX Havard Skinnemoen via
2020-10-24  5:26   ` Thomas Huth
2020-10-23 21:06 ` Havard Skinnemoen via [this message]
2020-10-23 21:06 ` [PATCH v3 3/6] hw/timer: Adding watchdog for NPCM7XX Timer Havard Skinnemoen via
2020-10-23 21:06 ` [PATCH v3 4/6] hw/misc: Add npcm7xx random number generator Havard Skinnemoen via
2020-10-30 13:34   ` Peter Maydell
2020-10-30 15:43     ` Havard Skinnemoen
2020-11-02 11:36   ` Peter Maydell
2020-11-02 16:50     ` Havard Skinnemoen
2020-11-02 17:13       ` Peter Maydell
2020-11-02 18:21         ` Havard Skinnemoen
2020-10-23 21:06 ` [PATCH v3 5/6] hw/arm/npcm7xx: Add EHCI and OHCI controllers Havard Skinnemoen via
2020-10-23 21:06 ` [PATCH v3 6/6] hw/gpio: Add GPIO model for Nuvoton NPCM7xx Havard Skinnemoen via
2020-10-26 17:15 ` [PATCH v3 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=20201023210637.351238-3-hskinnemoen@google.com \
    --to=qemu-devel@nongnu.org \
    --cc=Avi.Fishman@nuvoton.com \
    --cc=f4bug@amsat.org \
    --cc=hskinnemoen@google.com \
    --cc=kfting@nuvoton.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=venture@google.com \
    --cc=wuhaotsh@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.