diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2023-09-16 21:26:07 +0206 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2023-09-18 17:03:46 +0200 |
commit | 9757acd0a700ba4a0d16dde4ba820eb052aba1a7 (patch) | |
tree | 159b85fae4ed9c4cd1c7e0774229fde8c86f9ada /include/linux/console.h | |
parent | 06653d57ff283be627a2c769139d73ecc487810f (diff) |
printk: nbcon: Allow drivers to mark unsafe regions and check state
For the write_atomic callback, the console driver may have unsafe
regions that need to be appropriately marked. Provide functions
that accept the nbcon_write_context struct to allow for the driver
to enter and exit unsafe regions.
Also provide a function for drivers to check if they are still the
owner of the console.
Co-developed-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Thomas Gleixner (Intel) <tglx@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20230916192007.608398-9-john.ogness@linutronix.de
Diffstat (limited to 'include/linux/console.h')
-rw-r--r-- | include/linux/console.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/console.h b/include/linux/console.h index 14563dcb34b1..e4fc6f7c1496 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -451,6 +451,16 @@ static inline bool console_is_registered(const struct console *con) lockdep_assert_console_list_lock_held(); \ hlist_for_each_entry(con, &console_list, node) +#ifdef CONFIG_PRINTK +extern bool nbcon_can_proceed(struct nbcon_write_context *wctxt); +extern bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt); +extern bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt); +#else +static inline bool nbcon_can_proceed(struct nbcon_write_context *wctxt) { return false; } +static inline bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt) { return false; } +static inline bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt) { return false; } +#endif + extern int console_set_on_cmdline; extern struct console *early_console; |