From b9a8967954a229a56d514409aa992b28509da71a Mon Sep 17 00:00:00 2001 From: Marcin Witkowski Date: Tue, 30 Nov 2021 15:12:26 +0100 Subject: [PATCH] Fix getMaxUsToTicks function in RISC-V timer.h The getMaxUsToTicks function is supposed to return maximum amount of time you can pass to usToTicks without overflow, but in RISC-V implementation it returns ticks instead. This patch corrects it so it's implementation is akin to those in other platforms. Signed-off-by: Marcin Witkowski --- include/arch/riscv/arch/machine/timer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/arch/riscv/arch/machine/timer.h b/include/arch/riscv/arch/machine/timer.h index 4e1034552..de473b6a0 100644 --- a/include/arch/riscv/arch/machine/timer.h +++ b/include/arch/riscv/arch/machine/timer.h @@ -39,12 +39,12 @@ static inline PURE ticks_t getTimerPrecision(void) static inline CONST ticks_t getMaxTicksToUs(void) { - return UINT64_MAX / TICKS_IN_US; + return UINT64_MAX; } -static inline PURE time_t getMaxUsToTicks(void) +static inline CONST time_t getMaxUsToTicks(void) { - return usToTicks(getMaxTicksToUs()); + return UINT64_MAX / TICKS_IN_US; } /* Read the current time from the timer. */