Commit 0e53e2d9 authored by John Ogness's avatar John Ogness Committed by Petr Mladek

printk: Flush console on unregister_console()

Ensure consoles have flushed pending records before
unregistering. The console should print up to at least its
related "console disabled" record.
Signed-off-by: default avatarJohn Ogness <john.ogness@linutronix.de>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240904120536.115780-4-john.ogness@linutronix.deSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
parent e37577eb
......@@ -3771,11 +3771,16 @@ static int unregister_console_locked(struct console *console)
if (res > 0)
return 0;
if (!console_is_registered_locked(console))
res = -ENODEV;
else if (console_is_usable(console, console->flags))
__pr_flush(console, 1000, true);
/* Disable it unconditionally */
console_srcu_write_flags(console, console->flags & ~CON_ENABLED);
if (!console_is_registered_locked(console))
return -ENODEV;
if (res < 0)
return res;
/*
* Use the driver synchronization to ensure that the hardware is not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment