From 9f38d2a91ac5b42f3abe16d44365e59412215e67 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Thu, 9 Nov 2017 11:00:06 -0800 Subject: [PATCH] kernel: have k_sched_lock call _sched_lock Having two implementations of the same thing is bad, especially when one can just call the other inline version. Signed-off-by: Andrew Boie --- kernel/include/ksched.h | 8 ++------ kernel/sched.c | 15 +-------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/kernel/include/ksched.h b/kernel/include/ksched.h index f17def8d078..b0f1ad770da 100644 --- a/kernel/include/ksched.h +++ b/kernel/include/ksched.h @@ -239,12 +239,8 @@ static inline int _must_switch_threads(void) } /* - * Internal equivalent to k_sched_lock so that it does not incur a function - * call penalty in the kernel guts. - * - * Must be kept in sync until the header files are cleaned-up and the - * applications have access to the kernel internal deta structures (through - * APIs of course). + * Called directly by other internal kernel code. + * Exposed to applications via k_sched_lock(), which just calls this */ static inline void _sched_lock(void) { diff --git a/kernel/sched.c b/kernel/sched.c index 61b06e68df8..cbb335a1ee7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -137,20 +137,7 @@ void _reschedule_threads(int key) void k_sched_lock(void) { -#ifdef CONFIG_PREEMPT_ENABLED - __ASSERT(_current->base.sched_locked != 1, ""); - __ASSERT(!_is_in_isr(), ""); - - --_current->base.sched_locked; - - /* Probably not needed since we're in a real function, - * but it doesn't hurt. - */ - compiler_barrier(); - - K_DEBUG("scheduler locked (%p:%d)\n", - _current, _current->base.sched_locked); -#endif + _sched_lock(); } void k_sched_unlock(void)