From 3d29c9fe546cd42554becee9dddcbe2e9e73d5cc Mon Sep 17 00:00:00 2001 From: Qipeng Zha Date: Tue, 28 Nov 2023 12:17:42 +0800 Subject: [PATCH] kernel: timeout: fix issue with z_timeout_expires - issue found with Ztest case of test_thread_timeout_remaining_expires on Intel ISH platform when adjust CONFIG_SYS_CLOCK_TICKS_PER_SEC to 10k. - timeout_rem() return exact remaining ticks which is calibrated by decrease elapsed(), while z_timeout_expires try to get expire ticks to be timeout using current tick as base, so need get exact current ticks by plus elasped(). Signed-off-by: Qipeng Zha --- kernel/timeout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/timeout.c b/kernel/timeout.c index 16429bbba20..29f15898035 100644 --- a/kernel/timeout.c +++ b/kernel/timeout.c @@ -190,7 +190,7 @@ k_ticks_t z_timeout_expires(const struct _timeout *timeout) k_ticks_t ticks = 0; K_SPINLOCK(&timeout_lock) { - ticks = curr_tick + timeout_rem(timeout); + ticks = curr_tick + timeout_rem(timeout) + elapsed(); } return ticks;