diff options
author | John Ogness <john.ogness@linutronix.de> | 2024-08-20 08:29:43 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2024-08-21 14:56:24 +0200 |
commit | 20846d1ce2adacd2b1f8672e24d6acb26b2e757b (patch) | |
tree | 585d23b0ee5193cf44ed68d3f6c0c06b226cc942 /kernel/printk | |
parent | printk: Make console_is_usable() available to nbcon.c (diff) | |
download | linux-20846d1ce2adacd2b1f8672e24d6acb26b2e757b.tar.xz linux-20846d1ce2adacd2b1f8672e24d6acb26b2e757b.zip |
printk: Let console_is_usable() handle nbcon
The nbcon consoles use a different printing callback. For nbcon
consoles, check for the write_atomic() callback instead of
write().
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-18-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/internal.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 5d9deb56b582..448a5fcd5228 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -86,6 +86,8 @@ void nbcon_free(struct console *con); /* * Check if the given console is currently capable and allowed to print + * records. Note that this function does not consider the current context, + * which can also play a role in deciding if @con can be used to print * records. * * Requires the console_srcu_read_lock. @@ -100,8 +102,13 @@ static inline bool console_is_usable(struct console *con) if ((flags & CON_SUSPENDED)) return false; - if (!con->write) - return false; + if (flags & CON_NBCON) { + if (!con->write_atomic) + return false; + } else { + if (!con->write) + return false; + } /* * Console drivers may assume that per-cpu resources have been |