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 <qipeng.zha@intel.com>
This commit is contained in:
Qipeng Zha 2023-11-28 12:17:42 +08:00 committed by Carles Cufí
commit 3d29c9fe54

View file

@ -190,7 +190,7 @@ k_ticks_t z_timeout_expires(const struct _timeout *timeout)
k_ticks_t ticks = 0; k_ticks_t ticks = 0;
K_SPINLOCK(&timeout_lock) { K_SPINLOCK(&timeout_lock) {
ticks = curr_tick + timeout_rem(timeout); ticks = curr_tick + timeout_rem(timeout) + elapsed();
} }
return ticks; return ticks;