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>
diff --git a/include/kernel.h b/include/kernel.h
index eea4e62..9c353d0 100644
--- a/include/kernel.h
+++ b/include/kernel.h
@@ -2024,9 +2024,9 @@
*
* @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;
}
diff --git a/kernel/timer.c b/kernel/timer.c
index cc1c918..d338c17 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -256,7 +256,7 @@
}
#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);