kernel: timeout: detect inactive timeouts using dnode linked state

Whether a timeout is linked into the timeout queue can be determined
from the corresponding sys_dnode_t linked state.  This removes the need
to use a special flag value in dticks to determine that the timeout is
inactive.

Update _abort_timeout to return an error code, rather than the flag
value, when the timeout to be aborted was not active.

Remove the _INACTIVE flag value, and replace its external uses with an
internal API function that checks whether a timeout is inactive.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-01-02 08:29:43 -06:00 committed by Carles Cufí
commit b4ece0ad44
6 changed files with 15 additions and 17 deletions

View file

@ -873,9 +873,6 @@ __syscall void k_thread_start(k_tid_t thread);
/* timeout has timed out and is not on _timeout_q anymore */
#define _EXPIRED (-2)
/* timeout is not in use */
#define _INACTIVE (-1)
struct _static_thread_data {
struct k_thread *init_thread;
k_thread_stack_t *init_stack;
@ -1334,7 +1331,7 @@ struct k_timer {
#define _K_TIMER_INITIALIZER(obj, expiry, stop) \
{ \
.timeout.dticks = _INACTIVE, \
.timeout.dticks = 0, \
.timeout.fn = _timer_expiration_handler, \
.wait_q = _WAIT_Q_INIT(&obj.wait_q), \
.expiry_fn = expiry, \