Merge branch 'for-7.3-console-registration-cleanup' into for-linus

This commit is contained in:
Petr Mladek 2026-08-19 10:00:46 +02:00
commit 3783364ce6

View File

@ -3897,9 +3897,6 @@ static int console_call_setup(struct console *newcon, char *options)
* the newly registered console with any of the ones selected
* by either the command line or add_preferred_console() and
* setup/enable it.
*
* Care need to be taken with consoles that are statically
* enabled such as netconsole
*/
static int try_enable_preferred_console(struct console *newcon,
bool user_specified)
@ -3940,14 +3937,6 @@ static int try_enable_preferred_console(struct console *newcon,
return 0;
}
/*
* Some consoles, such as pstore and netconsole, can be enabled even
* without matching. Accept the pre-enabled consoles only when match()
* and setup() had a chance to be called.
*/
if (newcon->flags & CON_ENABLED && c->user_specified == user_specified)
return 0;
return -ENOENT;
}
@ -4130,6 +4119,14 @@ void register_console(struct console *newcon)
if (err == -ENOENT)
err = try_enable_preferred_console(newcon, false);
/*
* Some consoles, such as pstore and netconsole, can be enabled even
* without matching. Accept them at this stage when they had a chance
* to match() and call setup().
*/
if (err == -ENOENT && (newcon->flags & CON_ENABLED))
err = 0;
/* printk() messages are not printed to the Braille console. */
if (err || newcon->flags & CON_BRL) {
if (newcon->flags & CON_NBCON)