lkml.org 
[lkml]   [2021]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] printk/console: Split out code that enables default console
On (21/11/22 14:26), Petr Mladek wrote:
> Put the code enabling a console by default into a separate function
> called try_enable_default_console().
>
> Rename try_enable_new_console() to try_enable_preferred_console() to
> make the purpose of the different variants more clear.
>
> It is a code refactoring without any functional change.
>
> Signed-off-by: Petr Mladek <pmladek@suse.com>

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>

[..]
> -static int try_enable_new_console(struct console *newcon, bool user_specified)
> +static int try_enable_preferred_console(struct console *newcon,
> + bool user_specified)
> {
> struct console_cmdline *c;
> int i, err;
> @@ -2909,6 +2910,23 @@ static int try_enable_new_console(struct console *newcon, bool user_specified)
> return -ENOENT;
> }
>
> +/* Try to enable the console unconditionally */
> +static void try_enable_default_console(struct console *newcon)
> +{
> + if (newcon->index < 0)
> + newcon->index = 0;
> +
> + if (newcon->setup && newcon->setup(newcon, NULL) != 0)
> + return;
> +
> + newcon->flags |= CON_ENABLED;
> +
> + if (newcon->device) {
> + newcon->flags |= CON_CONSDEV;
> + has_preferred_console = true;
> + }
> +}

try_enable_default_console() also sets preferred_console, as well as
try_enable_preferred_console().

\
 
 \ /
  Last update: 2021-11-23 03:11    [W:0.068 / U:23.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site