aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-01 09:59:57 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-15 13:16:13 +0000
commitcc14bfc00362220c14082bcc8759863778b4ef0c (patch)
tree831216e1a697f0a1b5daabcd73c9ccc437e667f1
parent605a1d459f4fed3540f6d6d6d31b25b429b03e13 (diff)
downloadqemu-arm-cc14bfc00362220c14082bcc8759863778b4ef0c.tar.gz
hw/timer/npcm7xx_timer: Use new clock_ns_to_ticks()
Use the new clock_ns_to_ticks() function in npcm7xx_timer where appropriate. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Luc Michel <luc@lmichel.fr> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Hao Wu <wuhaotsh@google.com>
-rw-r--r--hw/timer/npcm7xx_timer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/timer/npcm7xx_timer.c b/hw/timer/npcm7xx_timer.c
index 4efdf135b8..32f5e021f8 100644
--- a/hw/timer/npcm7xx_timer.c
+++ b/hw/timer/npcm7xx_timer.c
@@ -138,8 +138,8 @@ static int64_t npcm7xx_timer_count_to_ns(NPCM7xxTimer *t, uint32_t count)
/* Convert a time interval in nanoseconds to a timer cycle count. */
static uint32_t npcm7xx_timer_ns_to_count(NPCM7xxTimer *t, int64_t ns)
{
- return ns / clock_ticks_to_ns(t->ctrl->clock,
- npcm7xx_tcsr_prescaler(t->tcsr));
+ return clock_ns_to_ticks(t->ctrl->clock, ns) /
+ npcm7xx_tcsr_prescaler(t->tcsr);
}
static uint32_t npcm7xx_watchdog_timer_prescaler(const NPCM7xxWatchdogTimer *t)