From: John Ogness <john.ogness@linutronix.de> Date: Tue, 12 Sep 2023 13:53:21 +0000 Subject: [PATCH 18/48] 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> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- kernel/printk/internal.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) Index: linux-6.8.2-rt10/kernel/printk/internal.h =================================================================== @ linux-6.8.2-rt10/kernel/printk/internal.h:90 @ 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. @ linux-6.8.2-rt10/kernel/printk/internal.h:106 @ static inline bool console_is_usable(str 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