LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Petr Mladek <pmladek@suse.com>
Cc: John Ogness <john.ogness@linutronix.de>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] printk/console: Rename has_preferred_console to need_default_console
Date: Tue, 23 Nov 2021 11:15:52 +0900 [thread overview]
Message-ID: <YZxO2I7D8uFQWKTF@google.com> (raw)
In-Reply-To: <20211122132649.12737-3-pmladek@suse.com>
On (21/11/22 14:26), Petr Mladek wrote:
> The logic around the variable @has_preferred_console made my head
> spin many times. Part of the problem is the ambiguous name.
>
> There is the variable @preferred_console. It points to the last
> non-braille console in @console_cmdline array. This array contains
> consoles preferred via the command line, device tree, or SPCR.
>
> Then there is the variable @has_preferred_console. It is set to
> "true" when @preferred_console is enabled or when a console with
> tty binding gets enabled by default.
>
> It might get reset back by the magic condition:
>
> if (!has_preferred_console || bcon || !console_drivers)
> has_preferred_console = preferred_console >= 0;
>
> It is a puzzle. Dumb explanation is that it gets re-evaluated
> when:
>
> + it was not set before (see above when it gets set)
> + there is still an early console enabled (bcon)
> + there is no console enabled (!console_drivers)
>
> This is still a puzzle.
>
> It gets more clear when we see where the value is checked. The only
> meaning of the variable is to decide whether we should try to enable
> the new console by default.
A nit: by "new console" you probably mean preferred_console. It sort
of suggests that try_enable_new_console() was not such a bad name,
may be, since we still refer to such consoles as "new" not "preferred".
> Rename the variable according to the single situation where
> the value is checked.
>
> The rename requires an inverted logic. Otherwise, it is a simple
> search & replace. It does not change the functionality.
>
> Signed-off-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
next prev parent reply other threads:[~2021-11-23 2:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 13:26 [PATCH 0/5] printk/console: Registration code cleanup - part 1 Petr Mladek
2021-11-22 13:26 ` [PATCH 1/5] printk/console: Split out code that enables default console Petr Mladek
2021-11-23 2:10 ` Sergey Senozhatsky
2021-11-23 10:21 ` Petr Mladek
2021-11-22 13:26 ` [PATCH 2/5] printk/console: Rename has_preferred_console to need_default_console Petr Mladek
2021-11-23 2:15 ` Sergey Senozhatsky [this message]
2021-11-23 10:51 ` Petr Mladek
2021-11-22 13:26 ` [PATCH 3/5] printk/console: Remove unnecessary need_default_console manipulation Petr Mladek
2021-11-22 13:26 ` [PATCH 4/5] printk/console: Remove need_default_console variable Petr Mladek
2021-11-22 13:26 ` [PATCH 5/5] printk/console: Clean up boot console handling in register_console() Petr Mladek
2021-12-06 13:54 ` [PATCH 0/5] printk/console: Registration code cleanup - part 1 Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YZxO2I7D8uFQWKTF@google.com \
--to=senozhatsky@chromium.org \
--cc=benh@kernel.crashing.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--subject='Re: [PATCH 2/5] printk/console: Rename has_preferred_console to need_default_console' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).