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 <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Reviewed-by: Douglas Anderson <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
This commit is contained in:
John Ogness authored and Petr Mladek committed 2022-12-02 11:25:02 +01:00
1 parent 28de287a95
commit 7e537af997
1 file changed
+8 -2
+8 -2
View File
@@ -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");