diff options
author | John Ogness <john.ogness@linutronix.de> | 2022-11-16 17:21:47 +0100 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2022-12-02 11:25:02 +0100 |
commit | 7e537af997748ea7a8df3f2b234a877ea9ef7791 (patch) | |
tree | a717659db3896e227b3b5d3c945012ba1dbe0d60 /drivers | |
parent | proc: consoles: use console_list_lock for list iteration (diff) | |
download | linux-7e537af997748ea7a8df3f2b234a877ea9ef7791.tar.xz linux-7e537af997748ea7a8df3f2b234a877ea9ef7791.zip |
tty: serial: kgdboc: use srcu console list iterator
Use srcu console list iteration for safe console list traversal.
Note that this is a preparatory change for when console_lock no
longer provides synchronization for the console list.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-36-john.ogness@linutronix.de
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/kgdboc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c index 5be381003e58..c6df9ef34099 100644 --- a/drivers/tty/serial/kgdboc.c +++ b/drivers/tty/serial/kgdboc.c @@ -451,6 +451,7 @@ static void kgdboc_earlycon_pre_exp_handler(void) { struct console *con; static bool already_warned; + int cookie; if (already_warned) return; @@ -463,9 +464,14 @@ static void kgdboc_earlycon_pre_exp_handler(void) * serial drivers might be OK with this, print a warning once per * boot if we detect this case. */ - for_each_console(con) + cookie = console_srcu_read_lock(); + for_each_console_srcu(con) { if (con == kgdboc_earlycon_io_ops.cons) - return; + break; + } + console_srcu_read_unlock(cookie); + if (con) + return; already_warned = true; pr_warn("kgdboc_earlycon is still using bootconsole\n"); |