From 00d7f2cfb64a8f4c99c88fed865560eab728a2e9 Mon Sep 17 00:00:00 2001 From: Enjia Mai Date: Wed, 9 Dec 2020 11:08:34 +0800 Subject: [PATCH] kernel: thread: make offload_sem visible for releasing it outside In order to release irq_offload semaphore outside kernel/thread.c, we make it visible by modifying it non-static under ztest. This would be needed such as when call irq_offload() to enter interrupt context and a fatal error happened, then you have to release it in your fatal handler, or the irq_offload will still be locked and no longer be using again. Signed-off-by: Enjia Mai --- kernel/thread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/thread.c b/kernel/thread.c index 72810de543f..6a6728dfbcc 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -908,7 +908,10 @@ static inline int z_vrfy_k_float_disable(struct k_thread *thread) #endif /* CONFIG_USERSPACE */ #ifdef CONFIG_IRQ_OFFLOAD -static K_SEM_DEFINE(offload_sem, 1, 1); +/* Make offload_sem visible outside under testing, in order to release + * it outside when error happened. + */ +K_SEM_DEFINE(offload_sem, 1, 1); void irq_offload(irq_offload_routine_t routine, const void *parameter) {