From ced7866901535daf3cfe6b52721dce9b9da143a8 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 6 Apr 2021 12:32:55 +0200 Subject: [PATCH] smp: move a preprocessor conditional from .c to cmake smp.c only has to be built if CONFIG_SMP is enabled. Remove preprocessor checks from the file itself and update cmake rules instead. Signed-off-by: Guennadi Liakhovetski --- kernel/CMakeLists.txt | 7 ++++++- kernel/smp.c | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 46ceb9e8895..3ecb87f6d36 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -27,10 +27,15 @@ list(APPEND kernel_files stack.c system_work_q.c work.c - smp.c sched.c condvar.c ) + +if(CONFIG_SMP) +list(APPEND kernel_files + smp.c) +endif() + endif() if(CONFIG_XIP) diff --git a/kernel/smp.c b/kernel/smp.c index 193897bd36d..f39af9d3957 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -10,7 +10,6 @@ #include #include -#ifdef CONFIG_SMP static atomic_t global_lock; static atomic_t start_flag; @@ -104,5 +103,3 @@ bool z_smp_cpu_mobile(void) arch_irq_unlock(k); return !pinned; } - -#endif /* CONFIG_SMP */