kernel: timer: update _timeout API for const correctness
API that takes _timeout structures but doesn't change data in them is updated to const-qualify the underlying object, allowing information to be retrieved from contexts where the containing object is immutable. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
e390105b0f
commit
16a4081520
3 changed files with 7 additions and 7 deletions
|
@ -1058,8 +1058,8 @@ __syscall void k_thread_abort(k_tid_t thread);
|
||||||
*/
|
*/
|
||||||
__syscall void k_thread_start(k_tid_t thread);
|
__syscall void k_thread_start(k_tid_t thread);
|
||||||
|
|
||||||
extern k_ticks_t z_timeout_expires(struct _timeout *timeout);
|
extern k_ticks_t z_timeout_expires(const struct _timeout *timeout);
|
||||||
extern k_ticks_t z_timeout_remaining(struct _timeout *timeout);
|
extern k_ticks_t z_timeout_remaining(const struct _timeout *timeout);
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ void z_add_timeout(struct _timeout *to, _timeout_func_t fn,
|
||||||
|
|
||||||
int z_abort_timeout(struct _timeout *to);
|
int z_abort_timeout(struct _timeout *to);
|
||||||
|
|
||||||
static inline bool z_is_inactive_timeout(struct _timeout *t)
|
static inline bool z_is_inactive_timeout(const struct _timeout *t)
|
||||||
{
|
{
|
||||||
return !sys_dnode_is_linked(&t->node);
|
return !sys_dnode_is_linked(&t->node);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ int32_t z_get_next_timeout_expiry(void);
|
||||||
|
|
||||||
void z_set_timeout_expiry(int32_t ticks, bool idle);
|
void z_set_timeout_expiry(int32_t ticks, bool idle);
|
||||||
|
|
||||||
k_ticks_t z_timeout_remaining(struct _timeout *timeout);
|
k_ticks_t z_timeout_remaining(const struct _timeout *timeout);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ int z_abort_timeout(struct _timeout *to)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be locked */
|
/* must be locked */
|
||||||
static k_ticks_t timeout_rem(struct _timeout *timeout)
|
static k_ticks_t timeout_rem(const struct _timeout *timeout)
|
||||||
{
|
{
|
||||||
k_ticks_t ticks = 0;
|
k_ticks_t ticks = 0;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ static k_ticks_t timeout_rem(struct _timeout *timeout)
|
||||||
return ticks - elapsed();
|
return ticks - elapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
k_ticks_t z_timeout_remaining(struct _timeout *timeout)
|
k_ticks_t z_timeout_remaining(const struct _timeout *timeout)
|
||||||
{
|
{
|
||||||
k_ticks_t ticks = 0;
|
k_ticks_t ticks = 0;
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ k_ticks_t z_timeout_remaining(struct _timeout *timeout)
|
||||||
return ticks;
|
return ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
k_ticks_t z_timeout_expires(struct _timeout *timeout)
|
k_ticks_t z_timeout_expires(const struct _timeout *timeout)
|
||||||
{
|
{
|
||||||
k_ticks_t ticks = 0;
|
k_ticks_t ticks = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue