Commit 7e537af9 authored by John Ogness's avatar John Ogness Committed by Petr Mladek
Browse files

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: default avatarJohn Ogness <john.ogness@linutronix.de>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-36-john.ogness@linutronix.de
parent 28de287a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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,8 +464,13 @@ 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)
			break;
	}
	console_srcu_read_unlock(cookie);
	if (con)
		return;

	already_warned = true;