diff --git a/lib/os/printk.c b/lib/os/printk.c index 1d47e373e87..4a6399cc03e 100644 --- a/lib/os/printk.c +++ b/lib/os/printk.c @@ -22,6 +22,11 @@ #include #include +/* Option present only when CONFIG_USERSPACE enabled. */ +#ifndef CONFIG_PRINTK_BUFFER_SIZE +#define CONFIG_PRINTK_BUFFER_SIZE 0 +#endif + #if defined(CONFIG_PRINTK_SYNC) && \ !(defined(CONFIG_LOG_PRINTK) && defined(CONFIG_LOG2)) static struct k_spinlock lock; @@ -77,7 +82,6 @@ void *__printk_get_hook(void) #if defined(CONFIG_PRINTK) && \ !(defined(CONFIG_LOG_PRINTK) && defined(CONFIG_LOG2)) -#ifdef CONFIG_USERSPACE struct buf_out_context { int count; unsigned int buf_count; @@ -102,7 +106,6 @@ static int buf_char_out(int c, void *ctx_p) return c; } -#endif /* CONFIG_USERSPACE */ struct out_context { int count; @@ -116,7 +119,6 @@ static int char_out(int c, void *ctx_p) return _char_out(c); } -#ifdef CONFIG_USERSPACE void vprintk(const char *fmt, va_list ap) { if (k_is_user_context()) { @@ -140,21 +142,6 @@ void vprintk(const char *fmt, va_list ap) #endif } } -#else -void vprintk(const char *fmt, va_list ap) -{ - struct out_context ctx = { 0 }; -#ifdef CONFIG_PRINTK_SYNC - k_spinlock_key_t key = k_spin_lock(&lock); -#endif - - cbvprintf(char_out, &ctx, fmt, ap); - -#ifdef CONFIG_PRINTK_SYNC - k_spin_unlock(&lock, key); -#endif -} -#endif /* CONFIG_USERSPACE */ void z_impl_k_str_out(char *c, size_t n) {