From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757570AbdHYRsh (ORCPT ); Fri, 25 Aug 2017 13:48:37 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33452 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757562AbdHYRsc (ORCPT ); Fri, 25 Aug 2017 13:48:32 -0400 Date: Sat, 26 Aug 2017 02:44:48 +0900 From: Sergey Senozhatsky To: Eugeniy Paltsev Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , 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: <20170825174448.GC5535@tigerII.localdomain> References: <20170825131451.15944-1-Eugeniy.Paltsev@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170825131451.15944-1-Eugeniy.Paltsev@synopsys.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/25/17 16:14), 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 hm... this is not the first time we see DT and stdout-path. and so far it was pretty painful :) e.g. commits c6c7d83b9c9e, 05fd007e4629. -ss > --- > 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 > + > /* > * See if we want to use this console driver. If we > * didn't select a console we take the first one > -- > 2.9.3 >