From patchwork Tue Mar 7 22:28:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 736379 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vdB4Q70Mwz9sDb for ; Wed, 8 Mar 2017 09:23:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933207AbdCGWXC (ORCPT ); Tue, 7 Mar 2017 17:23:02 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:25618 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756139AbdCGWWM (ORCPT ); Tue, 7 Mar 2017 17:22:12 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v27MLDiH028385 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 7 Mar 2017 22:21:14 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v27MLDEJ011049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 7 Mar 2017 22:21:13 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v27MLDgn031655 for ; Tue, 7 Mar 2017 22:21:13 GMT Received: from ca-ldom103.us.oracle.com (/10.129.68.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 Mar 2017 14:21:13 -0800 From: Pavel Tatashin To: sparclinux@vger.kernel.org Subject: [PATCH v1 2/4] sparc64: allow platforms to say when to unload boot console Date: Tue, 7 Mar 2017 17:28:37 -0500 Message-Id: <1488925719-647821-3-git-send-email-pasha.tatashin@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1488925719-647821-1-git-send-email-pasha.tatashin@oracle.com> References: <1488925719-647821-1-git-send-email-pasha.tatashin@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Add a weak function that can be overwritten by platforms that tells whether it is time to unregister boot console. Signed-off-by: Pavel Tatashin Shannon Nelson --- kernel/printk/printk.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 2984fb0..e5c7baa 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2385,6 +2385,16 @@ static int __init keep_bootcon_setup(char *str) early_param("keep_bootcon", keep_bootcon_setup); /* + * Returns true of boot console should be kept, can be overwritten by platforms + */ +bool __weak plat_unregister_bootcon(struct console *newcon, + struct console *bcon) +{ + return bcon && + (newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV; +} + +/* * The console driver calls this routine during kernel initialization * to register the console printing procedure with printk() and to * print any messages that were printed by the kernel before the @@ -2409,6 +2419,7 @@ void register_console(struct console *newcon) unsigned long flags; struct console *bcon = NULL; struct console_cmdline *c; + bool unreg_bootcon; if (console_drivers) for_each_console(bcon) @@ -2503,6 +2514,8 @@ void register_console(struct console *newcon) if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) newcon->flags &= ~CON_PRINTBUFFER; + unreg_bootcon = plat_unregister_bootcon(newcon, bcon); + /* * Put this console in the list - keep the * preferred driver at the head of the list. @@ -2551,9 +2564,7 @@ void register_console(struct console *newcon) pr_info("%sconsole [%s%d] enabled\n", (newcon->flags & CON_BOOT) ? "boot" : "" , newcon->name, newcon->index); - if (bcon && - ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV) && - !keep_bootcon) { + if (unreg_bootcon && !keep_bootcon) { /* We need to iterate through all boot consoles, to make * sure we print everything out, before we unregister them. */