mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] console: don't select first registered console if stdout-path used
Date: Fri, 25 Aug 2017 09:20:16 -0400	[thread overview]
Message-ID: <20170825092016.66ef2fe0@gandalf.local.home> (raw)
In-Reply-To: <20170825131451.15944-1-Eugeniy.Paltsev@synopsys.com>

On Fri, 25 Aug 2017 16:14:51 +0300
Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> wrote:

> In the current implementation we take the first console that
> registers if we didn't select one.
> 
> But if we specify console via "stdout-path" property in device tree
> we don't want first console that registers here to be selected.
> Otherwise we may choose wrong console - for example if some console
> is registered earlier than console is pointed in "stdout-path"
> property because console pointed in "stdout-path" property can be add as
> preferred quite late - when it's driver is probed.
> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  kernel/printk/printk.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 512f7c2..23262c1 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -26,6 +26,7 @@
>  #include <linux/nmi.h>
>  #include <linux/module.h>
>  #include <linux/moduleparam.h>
> +#include <linux/of.h>
>  #include <linux/delay.h>
>  #include <linux/smp.h>
>  #include <linux/security.h>
> @@ -2431,6 +2432,16 @@ void register_console(struct console *newcon)
>  	if (!has_preferred || bcon || !console_drivers)
>  		has_preferred = preferred_console >= 0;
>  
> +
> +	/*
> +	 * If we specify console via "stdout-path" property in device tree
> +	 * we don't want first console that registers here to be selected.
> +	 */
> +#ifdef CONFIG_OF
> +	if (of_stdout)
> +		has_preferred = true;
> +#endif

To remove the #ifdef from the code, could the of.h move

#ifdef CONFIG_OF

Above the extern declarations of of_stdout and friends, and then have:

#else /* !CONFIG_OF */

#define of_stdout	NULL

#endif

Then we could just have:

	if (of_stdout)
		has_preferred = true;

without the ifdefs.

-- Steve

> +
>  	/*
>  	 *	See if we want to use this console driver. If we
>  	 *	didn't select a console we take the first one

  reply	other threads:[~2017-08-25 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25 13:14 Eugeniy Paltsev
2017-08-25 13:20 ` Steven Rostedt [this message]
2017-08-25 17:44 ` Sergey Senozhatsky
2017-08-28 12:41   ` Eugeniy Paltsev

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=20170825092016.66ef2fe0@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=pmladek@suse.com \
    --cc=sergey.senozhatsky@gmail.com \
    /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®