printk: Avoid console_lock dance if no legacy or boot consoles
authorJohn Ogness <john.ogness@linutronix.de>
Tue, 20 Aug 2024 06:29:53 +0000 (08:35 +0206)
committerPetr Mladek <pmladek@suse.com>
Wed, 21 Aug 2024 12:56:24 +0000 (14:56 +0200)
commit60013065fdc677df7b71f9a0bac501020e3bbd4f
tree78b3a95655db51217b82945a1bd0348164488e19
parent5dde3b7354133846079fa51e55e74ef90a836759
printk: Avoid console_lock dance if no legacy or boot consoles

Currently the console lock is used to attempt legacy-type
printing even if there are no legacy or boot consoles registered.
If no such consoles are registered, the console lock does not
need to be taken.

Add tracking of legacy console registration and use it with
boot console tracking to avoid unnecessary code paths, i.e.
do not use the console lock if there are no boot consoles
and no legacy consoles.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-28-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
kernel/printk/printk.c