mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andre Kalb <andre.kalb@sma.de>,
	john.ogness@linutronix.de, linux-kernel@vger.kernel.org,
	rostedt@goodmis.org
Subject: Re: [PATCH v2] printk: Set console_set_on_cmdline=1 when __add_preferred_console() is called with user_specified == true
Date: Tue, 15 Feb 2022 18:58:14 +0100	[thread overview]
Message-ID: <YgvptpD/g4hj0bsp@alley> (raw)
In-Reply-To: <Ygsa7gfqlhZVWdDb@google.com>

On Tue 2022-02-15 12:15:58, Sergey Senozhatsky wrote:
> On (22/02/14 14:21), Andre Kalb wrote:
> > +static void set_user_specified(struct console_cmdline *c, bool user_specified)
> > +{
> > +	if (!user_specified)
> > +		return;
> > +
> > +	c->user_specified = true;
> > +	console_set_on_cmdline = 1;
> > +}
> 
> In original code we always set c->user_specified. Is it guaranteed that
> ->user_specified is properly initialized to 0? Maybe can do something like:

It is guaranteed. console_cmdline is a static array initialized with
zeroes. The 2nd set_user_specified() call is done for a not-yet-used
slot in the array, so it must be zero.


> static void set_user_specified(struct console_cmdline *c, bool user_specified)
> {
> 	c->user_specified = user_specified;

This will change the behavior for the 1st set_user_specified() call.
It happens when the same console is added more times by device tree,
SPCR, and/or command line. c->user_specified must stay "true" when
at least one __add_preferred_console() call added it from the command line.

> 	if (!user_specified)
> 		return;
> 
> 	console_set_on_cmdline = 1;
> }

I agree that it is not obvious. It would make sense to add a comment
into the code. I am going to propose something in a reply to the
original post.

Best Regards,
Petr

  reply	other threads:[~2022-02-15 17:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 23:00 [PATCH] printk: Set console_set_on_cmdline=1 when using console="" or console=null Andre Kalb
2022-02-08 15:55 ` Petr Mladek
2022-02-14 13:21   ` [PATCH v2] printk: Set console_set_on_cmdline=1 when __add_preferred_console() is called with user_specified == true Andre Kalb
2022-02-15  3:15     ` Sergey Senozhatsky
2022-02-15 17:58       ` Petr Mladek [this message]
2022-02-15 18:10     ` Petr Mladek
2022-02-16  3:18       ` Sergey Senozhatsky
2022-02-16 10:41         ` [PATCH v3] " Andre Kalb
2022-02-21 15:49           ` 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=YgvptpD/g4hj0bsp@alley \
    --to=pmladek@suse.com \
    --cc=andre.kalb@sma.de \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®