From patchwork Fri Aug 25 13:14:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 805860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iPDFcU0V"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xf1qc4zxRz9s81 for ; Fri, 25 Aug 2017 23:15:24 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=PXkmJTCPr5/FZa3JN4B4U3H0a0VX/WuDobeZvu+XT1E=; b=iPD FcU0VotGQ2N9xVnYn/j5r9QWH1/L/b+LG/0qDmCyeZMJTxjZqSmdJwsxW7iTH93h8qddZV//Pd3hP 7SDz+sfh8+uEib6EWhpMTp3LCGmLyHyMyD1cJYT/q9w1s0ujpWnYAlNx44cUvRfMqX3wmy2Co0VjS +AbpsTzHXiCjJ3M8+KWkJKmNWxZybrOmFg4blwKNCynt+3fUtxf9+O/FpQtYIbCzr3pr2TBwk5V9G R98Y2zAMYks5f7IROMCnGgJ9y5gIgjEuH+4RXK8TiJBwEDiyBqRJtbdU2r3ceIYpXFKB+Uyc6YrHD 1w7AyRN0sNPVrbzfuCcKa4wtiT4CXjw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dlESJ-0003Vn-5c; Fri, 25 Aug 2017 13:15:23 +0000 Received: from smtprelay2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dlESF-0002Ca-QX for linux-snps-arc@lists.infradead.org; Fri, 25 Aug 2017 13:15:21 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 7E89710C125F; Fri, 25 Aug 2017 06:14:56 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 6654BD41; Fri, 25 Aug 2017 06:14:56 -0700 (PDT) Received: from localhost.internal.synopsys.com (unknown [10.121.8.106]) by mailhost.synopsys.com (Postfix) with ESMTP id 95281D1C; Fri, 25 Aug 2017 06:14:54 -0700 (PDT) From: Eugeniy Paltsev To: Petr Mladek , Sergey Senozhatsky Subject: [PATCH] console: don't select first registered console if stdout-path used Date: Fri, 25 Aug 2017 16:14:51 +0300 Message-Id: <20170825131451.15944-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170825_061519_955243_213D1E3B X-CRM114-Status: UNSURE ( 8.01 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-snps-arc@lists.infradead.org, Eugeniy Paltsev , linux-kernel@vger.kernel.org, Steven Rostedt MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 + /* * See if we want to use this console driver. If we * didn't select a console we take the first one