From 3ed8083dc1625b0f3043b95a3cd6fb1dbd04f84b Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 26 Nov 2020 19:32:34 +0100 Subject: [PATCH] kernel: Cleanup logger setup in kernel files Most of kernel files where declaring os module without providing log level. Because of that default log level was used instead of CONFIG_KERNEL_LOG_LEVEL. Signed-off-by: Krzysztof Chruscinski --- arch/arc/core/fatal.c | 2 +- arch/arc/core/fault.c | 2 +- arch/arm/core/aarch32/cortex_a_r/fault.c | 2 +- arch/arm/core/aarch32/cortex_m/fault.c | 2 +- arch/arm/core/aarch32/fatal.c | 2 +- arch/arm/core/aarch64/fatal.c | 2 +- arch/nios2/core/fatal.c | 2 +- arch/nios2/core/irq_manage.c | 2 +- arch/riscv/core/fatal.c | 2 +- arch/riscv/core/irq_manage.c | 2 +- arch/sparc/core/fatal.c | 2 +- arch/sparc/core/irq_manage.c | 2 +- arch/x86/core/fatal.c | 2 +- arch/x86/core/ia32/fatal.c | 2 +- arch/x86/core/intel64/fatal.c | 2 +- arch/x86/core/intel64/irq.c | 2 +- arch/x86/core/x86_mmu.c | 2 +- arch/xtensa/core/fatal.c | 2 +- arch/xtensa/core/xtensa-asm2.c | 2 +- include/syscall_handler.h | 2 +- kernel/fatal.c | 2 +- kernel/idle.c | 2 +- kernel/init.c | 4 +--- kernel/mem_domain.c | 4 +--- kernel/mmu.c | 10 ++++------ kernel/mutex.c | 2 +- kernel/sched.c | 2 +- kernel/thread.c | 4 +--- kernel/thread_abort.c | 2 +- kernel/userspace.c | 3 +-- lib/libc/minimal/source/stdlib/malloc.c | 4 +--- 31 files changed, 34 insertions(+), 45 deletions(-) diff --git a/arch/arc/core/fatal.c b/arch/arc/core/fatal.c index bf3fe8bb32c..31d56fc1060 100644 --- a/arch/arc/core/fatal.c +++ b/arch/arc/core/fatal.c @@ -19,7 +19,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_ARC_EXCEPTION_DEBUG static void dump_arc_esf(const z_arch_esf_t *esf) diff --git a/arch/arc/core/fault.c b/arch/arc/core/fault.c index 95bdad4f67a..c344051247c 100644 --- a/arch/arc/core/fault.c +++ b/arch/arc/core/fault.c @@ -20,7 +20,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_USERSPACE Z_EXC_DECLARE(z_arc_user_string_nlen); diff --git a/arch/arm/core/aarch32/cortex_a_r/fault.c b/arch/arm/core/aarch32/cortex_a_r/fault.c index df3f676e6b5..007ee295056 100644 --- a/arch/arm/core/aarch32/cortex_a_r/fault.c +++ b/arch/arm/core/aarch32/cortex_a_r/fault.c @@ -8,7 +8,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #define FAULT_DUMP_VERBOSE (CONFIG_FAULT_DUMP == 2) diff --git a/arch/arm/core/aarch32/cortex_m/fault.c b/arch/arm/core/aarch32/cortex_m/fault.c index 964d7483b78..4eb2b0aae43 100644 --- a/arch/arm/core/aarch32/cortex_m/fault.c +++ b/arch/arm/core/aarch32/cortex_m/fault.c @@ -17,7 +17,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #if defined(CONFIG_PRINTK) || defined(CONFIG_LOG) #define PR_EXC(...) LOG_ERR(__VA_ARGS__) diff --git a/arch/arm/core/aarch32/fatal.c b/arch/arm/core/aarch32/fatal.c index f8aca7ed022..71c92850a6a 100644 --- a/arch/arm/core/aarch32/fatal.c +++ b/arch/arm/core/aarch32/fatal.c @@ -14,7 +14,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); static void esf_dump(const z_arch_esf_t *esf) { diff --git a/arch/arm/core/aarch64/fatal.c b/arch/arm/core/aarch64/fatal.c index 5145924bdb7..4cce8019f53 100644 --- a/arch/arm/core/aarch64/fatal.c +++ b/arch/arm/core/aarch64/fatal.c @@ -16,7 +16,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_EXCEPTION_DEBUG static void dump_esr(uint64_t esr, bool *dump_far) diff --git a/arch/nios2/core/fatal.c b/arch/nios2/core/fatal.c index e6188083c8d..aaff1fe5d35 100644 --- a/arch/nios2/core/fatal.c +++ b/arch/nios2/core/fatal.c @@ -9,7 +9,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_nios2_fatal_error(unsigned int reason, const z_arch_esf_t *esf) diff --git a/arch/nios2/core/irq_manage.c b/arch/nios2/core/irq_manage.c index f8f72993ec2..26f92ef23bb 100644 --- a/arch/nios2/core/irq_manage.c +++ b/arch/nios2/core/irq_manage.c @@ -20,7 +20,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_irq_spurious(const void *unused) { diff --git a/arch/riscv/core/fatal.c b/arch/riscv/core/fatal.c index 46092c462b6..e52baa498f2 100644 --- a/arch/riscv/core/fatal.c +++ b/arch/riscv/core/fatal.c @@ -9,7 +9,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_USERSPACE Z_EXC_DECLARE(z_riscv_user_string_nlen); diff --git a/arch/riscv/core/irq_manage.c b/arch/riscv/core/irq_manage.c index c2798e3e3d1..d7a9b187964 100644 --- a/arch/riscv/core/irq_manage.c +++ b/arch/riscv/core/irq_manage.c @@ -7,7 +7,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_irq_spurious(const void *unused) { diff --git a/arch/sparc/core/fatal.c b/arch/sparc/core/fatal.c index 87a81a8edb5..fc685024e74 100644 --- a/arch/sparc/core/fatal.c +++ b/arch/sparc/core/fatal.c @@ -6,7 +6,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_sparc_fatal_error(unsigned int reason, const z_arch_esf_t *esf) diff --git a/arch/sparc/core/irq_manage.c b/arch/sparc/core/irq_manage.c index 28c73faf18e..95d0523b518 100644 --- a/arch/sparc/core/irq_manage.c +++ b/arch/sparc/core/irq_manage.c @@ -8,7 +8,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_irq_spurious(const void *unused) { diff --git a/arch/x86/core/fatal.c b/arch/x86/core/fatal.c index e650293cb8c..2c01daf3917 100644 --- a/arch/x86/core/fatal.c +++ b/arch/x86/core/fatal.c @@ -10,7 +10,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #if defined(CONFIG_BOARD_QEMU_X86) || defined(CONFIG_BOARD_QEMU_X86_64) FUNC_NORETURN void arch_system_halt(unsigned int reason) diff --git a/arch/x86/core/ia32/fatal.c b/arch/x86/core/ia32/fatal.c index 1dfe3878324..2f781de574d 100644 --- a/arch/x86/core/ia32/fatal.c +++ b/arch/x86/core/ia32/fatal.c @@ -21,7 +21,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_DEBUG_COREDUMP unsigned int z_x86_exception_vector; diff --git a/arch/x86/core/intel64/fatal.c b/arch/x86/core/intel64/fatal.c index 15580fa2215..29ab260186e 100644 --- a/arch/x86/core/intel64/fatal.c +++ b/arch/x86/core/intel64/fatal.c @@ -8,7 +8,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); void z_x86_exception(z_arch_esf_t *esf) { diff --git a/arch/x86/core/intel64/irq.c b/arch/x86/core/intel64/irq.c index b3553635e13..e3faa3f37ba 100644 --- a/arch/x86/core/intel64/irq.c +++ b/arch/x86/core/intel64/irq.c @@ -13,7 +13,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); unsigned char _irq_to_interrupt_vector[CONFIG_MAX_IRQ_LINES]; diff --git a/arch/x86/core/x86_mmu.c b/arch/x86/core/x86_mmu.c index 9e52782fe6c..00470277b2d 100644 --- a/arch/x86/core/x86_mmu.c +++ b/arch/x86/core/x86_mmu.c @@ -19,7 +19,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* We will use some ignored bits in the PTE to backup permission settings * when the mapping was made. This is used to un-apply memory domain memory diff --git a/arch/xtensa/core/fatal.c b/arch/xtensa/core/fatal.c index 1576ece0f7e..cea4c4f8203 100644 --- a/arch/xtensa/core/fatal.c +++ b/arch/xtensa/core/fatal.c @@ -11,7 +11,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef XT_SIMULATOR #include diff --git a/arch/xtensa/core/xtensa-asm2.c b/arch/xtensa/core/xtensa-asm2.c index 4045cb90c23..16ee3578828 100644 --- a/arch/xtensa/core/xtensa-asm2.c +++ b/arch/xtensa/core/xtensa-asm2.c @@ -13,7 +13,7 @@ #include <_soc_inthandlers.h> #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); void *xtensa_init_stack(struct k_thread *thread, int *stack_top, void (*entry)(void *, void *, void *), diff --git a/include/syscall_handler.h b/include/syscall_handler.h index 60d8bbbe2e0..a39ac0427be 100644 --- a/include/syscall_handler.h +++ b/include/syscall_handler.h @@ -311,7 +311,7 @@ extern int z_user_string_copy(char *dst, const char *src, size_t maxlen); #define Z_SYSCALL_VERIFY_MSG(expr, fmt, ...) ({ \ bool expr_copy = !(expr); \ if (expr_copy) { \ - LOG_MODULE_DECLARE(os); \ + LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); \ LOG_ERR("syscall %s failed check: " fmt, \ __func__, ##__VA_ARGS__); \ } \ diff --git a/kernel/fatal.c b/kernel/fatal.c index 077c6f8b691..6f86603131e 100644 --- a/kernel/fatal.c +++ b/kernel/fatal.c @@ -15,7 +15,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* LCOV_EXCL_START */ FUNC_NORETURN __weak void arch_system_halt(unsigned int reason) diff --git a/kernel/idle.c b/kernel/idle.c index 191a0a3dfc4..0d7aea7ec95 100644 --- a/kernel/idle.c +++ b/kernel/idle.c @@ -14,7 +14,7 @@ #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_TICKLESS_IDLE_THRESH #define IDLE_THRESH CONFIG_TICKLESS_IDLE_THRESH diff --git a/kernel/init.c b/kernel/init.c index 38dde05b144..a9744ac3d17 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -35,10 +35,8 @@ #include #include #include - -#define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL #include -LOG_MODULE_REGISTER(os); +LOG_MODULE_REGISTER(os, CONFIG_KERNEL_LOG_LEVEL); /* boot banner items */ #if defined(CONFIG_MULTITHREADING) && defined(CONFIG_BOOT_DELAY) \ diff --git a/kernel/mem_domain.c b/kernel/mem_domain.c index 95f1cca696e..f9717d013f8 100644 --- a/kernel/mem_domain.c +++ b/kernel/mem_domain.c @@ -12,10 +12,8 @@ #include #include #include - -#define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); struct k_spinlock z_mem_domain_lock; static uint8_t max_partitions; diff --git a/kernel/mmu.c b/kernel/mmu.c index d599e6e261a..31fc786e45f 100644 --- a/kernel/mmu.c +++ b/kernel/mmu.c @@ -6,13 +6,11 @@ * Routines for managing virtual address spaces */ - #include - #include - #include - -#define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL +#include +#include +#include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* Spinlock to protect any globals in this file and serialize page table * updates in arch code diff --git a/kernel/mutex.c b/kernel/mutex.c index 3c41dd19454..dd39013e347 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -38,7 +38,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* We use a global spinlock here because some of the synchronization * is protecting things like owner thread priorities which aren't diff --git a/kernel/sched.c b/kernel/sched.c index 618bfa4c3a4..70907027c1e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -16,7 +16,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* Maximum time between the time a self-aborting thread flags itself * DEAD and the last read or write to its stack memory (i.e. the time diff --git a/kernel/thread.c b/kernel/thread.c index 6a9760fe91d..72810de543f 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -28,10 +28,8 @@ #include #include #include - -#define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_THREAD_RUNTIME_STATS k_thread_runtime_stats_t threads_runtime_stats; diff --git a/kernel/thread_abort.c b/kernel/thread_abort.c index a9bfed92585..e6de702f2d6 100644 --- a/kernel/thread_abort.c +++ b/kernel/thread_abort.c @@ -22,7 +22,7 @@ #include #include #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); FUNC_NORETURN void z_self_abort(void) { diff --git a/kernel/userspace.c b/kernel/userspace.c index 1784035d709..316dc33bb0e 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -34,9 +34,8 @@ K_APPMEM_PARTITION_DEFINE(z_libc_partition); K_APPMEM_PARTITION_DEFINE(k_mbedtls_partition); #endif -#define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); /* The originally synchronization strategy made heavy use of recursive * irq_locking, which ports poorly to spinlocks which are diff --git a/lib/libc/minimal/source/stdlib/malloc.c b/lib/libc/minimal/source/stdlib/malloc.c index c5572596f94..c3e3314a787 100644 --- a/lib/libc/minimal/source/stdlib/malloc.c +++ b/lib/libc/minimal/source/stdlib/malloc.c @@ -12,10 +12,8 @@ #include #include #include - -#define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL #include -LOG_MODULE_DECLARE(os); +LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #ifdef CONFIG_MINIMAL_LIBC_MALLOC