diff options
author | John Ogness <john.ogness@linutronix.de> | 2022-11-16 17:27:34 +0106 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2022-12-02 11:25:01 +0100 |
commit | 452b9b24754044eced1508f9090611f3d9aa4ca5 (patch) | |
tree | 2a62bf857667426d2b2edc65da299276cc45c69a /include/linux/serial_core.h | |
parent | 1fd4224a6b641f1949e27bf350b5b1c1e47e2ccc (diff) | |
download | linux-452b9b24754044eced1508f9090611f3d9aa4ca5.tar.gz linux-452b9b24754044eced1508f9090611f3d9aa4ca5.tar.bz2 linux-452b9b24754044eced1508f9090611f3d9aa4ca5.zip |
serial_core: replace uart_console_enabled() with uart_console_registered()
All users of uart_console_enabled() really want to know if a console
is registered. It is not reliable to check for CON_ENABLED in order
to identify if a console is registered. Use console_is_registered()
instead.
A _locked() variant is provided because uart_set_options() is always
called with the console_list_lock held and must check if a console
is registered in order to synchronize with kgdboc.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-23-john.ogness@linutronix.de
Diffstat (limited to 'include/linux/serial_core.h')
-rw-r--r-- | include/linux/serial_core.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index d657f2a42a7b..91871464b99d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -743,9 +743,15 @@ static const bool earlycon_acpi_spcr_enable EARLYCON_USED_OR_UNUSED; static inline int setup_earlycon(char *buf) { return 0; } #endif -static inline bool uart_console_enabled(struct uart_port *port) +/* Variant of uart_console_registered() when the console_list_lock is held. */ +static inline bool uart_console_registered_locked(struct uart_port *port) { - return uart_console(port) && (port->cons->flags & CON_ENABLED); + return uart_console(port) && console_is_registered_locked(port->cons); +} + +static inline bool uart_console_registered(struct uart_port *port) +{ + return uart_console(port) && console_is_registered(port->cons); } struct uart_port *uart_get_console(struct uart_port *ports, int nr, |