From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932533AbdHYNUU (ORCPT ); Fri, 25 Aug 2017 09:20:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756826AbdHYNUT (ORCPT ); Fri, 25 Aug 2017 09:20:19 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4938A2156A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Fri, 25 Aug 2017 09:20:16 -0400 From: Steven Rostedt To: Eugeniy Paltsev Cc: Petr Mladek , Sergey Senozhatsky , 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 Message-ID: <20170825092016.66ef2fe0@gandalf.local.home> In-Reply-To: <20170825131451.15944-1-Eugeniy.Paltsev@synopsys.com> References: <20170825131451.15944-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Aug 2017 16:14:51 +0300 Eugeniy Paltsev 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 > --- > 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 > #include > #include > +#include > #include > #include > #include > @@ -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