diff options
author | Richard Braun <rbraun@sceen.net> | 2017-12-03 15:08:01 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-12-03 15:08:01 +0100 |
commit | 303ed5305f8dae17ab46aa1e0dc6086d4277808c (patch) | |
tree | 5275ceb2c2321970a3a92cbcb9d17b5bf8b7d048 /kern/log.c | |
parent | 10790d4b1f1f3546fa110fea313a08cce999243f (diff) |
kern/shell: don't make the public interface conditional
Diffstat (limited to 'kern/log.c')
-rw-r--r-- | kern/log.c | 31 |
1 files changed, 22 insertions, 9 deletions
@@ -267,19 +267,38 @@ log_record_print(const struct log_record *record, unsigned int level) } } +#ifdef CONFIG_SHELL + +static void +log_start_shell(unsigned long *flags) +{ + static bool shell_started = false; + + if (shell_started) { + return; + } + + spinlock_unlock_intr_restore(&log_lock, *flags); + shell_start(); + spinlock_lock_intr_save(&log_lock, flags); + shell_started = true; +} + +#else /* CONFIG_SHELL */ +#define log_start_shell(flags) +#endif /* CONFIG_SHELL*/ + static void log_run(void *arg) { unsigned long flags, nr_overruns; struct log_consume_ctx ctx; struct log_record record; - bool start_shell; int error; (void)arg; nr_overruns = 0; - start_shell = true; spinlock_lock_intr_save(&log_lock, &flags); @@ -292,13 +311,7 @@ log_run(void *arg) * time cleanly serializes log messages and shell prompt, making * a clean ordered output. */ - if (start_shell) { - spinlock_unlock_intr_restore(&log_lock, flags); - shell_start(); - start_shell = false; - spinlock_lock_intr_save(&log_lock, &flags); - } - + log_start_shell(&flags); log_index = log_consume_ctx_index(&ctx); thread_sleep(&log_lock, &log_cbuf, "log_cbuf"); |