kernel: timer: update k_timer API for const correctness

API that takes k_timer 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:
Peter A. Bigot 2020-09-18 16:24:57 -05:00 committed by Carles Cufí
parent 16a4081520
commit f1b86caff3
2 changed files with 3 additions and 3 deletions

View file

@ -2024,9 +2024,9 @@ static inline void z_impl_k_timer_user_data_set(struct k_timer *timer,
*
* @return The user data.
*/
__syscall void *k_timer_user_data_get(struct k_timer *timer);
__syscall void *k_timer_user_data_get(const struct k_timer *timer);
static inline void *z_impl_k_timer_user_data_get(struct k_timer *timer)
static inline void *z_impl_k_timer_user_data_get(const struct k_timer *timer)
{
return timer->user_data;
}

View file

@ -256,7 +256,7 @@ static inline k_ticks_t z_vrfy_k_timer_expires_ticks(struct k_timer *timer)
}
#include <syscalls/k_timer_expires_ticks_mrsh.c>
static inline void *z_vrfy_k_timer_user_data_get(struct k_timer *timer)
static inline void *z_vrfy_k_timer_user_data_get(const struct k_timer *timer)
{
Z_OOPS(Z_SYSCALL_OBJ(timer, K_OBJ_TIMER));
return z_impl_k_timer_user_data_get(timer);