Received: by 2002:a05:7412:b112:b0:f9:3106:f1c0 with SMTP id az18csp92866rdb; Sun, 17 Dec 2023 23:13:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeRPcnjnvDBstDuWhlFjKYommloXfoNJpzbM5Ba00qSCTds9wwwabyM0gugtQJBiF3oTaB X-Received: by 2002:a17:906:f142:b0:a1d:5483:d152 with SMTP id gw2-20020a170906f14200b00a1d5483d152mr14581683ejb.68.1702883599128; Sun, 17 Dec 2023 23:13:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702883599; cv=none; d=google.com; s=arc-20160816; b=T7zQTF4JfgbG/ByG+pHBZjxzepbFgflEu4hkxEX7u7UgUYo+RWD6qHmz0BtAU+OQpF ADN6+uUwO19MyJLY2S5VrmHVmtXa13dD8P68VZbT8w0XxsU3/j+y8Y2YlcLvOUuMrkiw CVSY06zQCFVAeZWNEBTWnrYO3XmWGVtqGDZRSn+Zfxv0YxeXg/XiknqMc2rx5LMC+FC9 ZJerDrm6XnBGx8JZdqiVPn5i7a9c2yhJtf9C4FbOg7J24LrLQdHgP59485r/ks+YT2av f6xu2IQ31JzMC8E8HZL8ZkhDsWOLiFD+NJDR9XgHfihmzluJCjSZm+/9YwnX3OXkufZv ZS9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=H/MoLw5lmXSOQD44TfhotjzJldk5fxG1yVLpDlQEoks=; fh=OQrZIrddo55Tm+afxTOsnGwFgD38y2NNd7tU+1OGSCE=; b=kJHH8no6PCi5PGdTz0k7l/kuboZIMlrePnHCD/s7BYjA4+XeYmtp6s0/PXCuXw558F W25KB2tECvN1pLPQo65Z0x0gmXJEZtpbV8A9upLb6ba3Z/4NkCf5T/zfgLpXK0L9aS4O 2uryX3tDE4q28ZF4xvZWExLkHpTIQnd116/kXLgE+MA0O29GvhSlKAu+IPx6IVcOd77c 2bdAZCCBqAhnPnak9bCtFYFo5GI2Y0ALsHJCmxzVPEMM3ekXEclAjuBRrHb2Ir1P2p5c sa5YHJkCCR8uHtcpscmbxbK0j3IC/wNy17SCforGW05HlAhb6H8UxbrVagbw2OnJ4ClN Y0ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atomide.com header.s=25mailst header.b=ZeewQB+j; spf=pass (google.com: domain of linux-kernel+bounces-3085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3085-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a17-20020a170906245100b00a2362d2fcc4si178397ejb.841.2023.12.17.23.13.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 23:13:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@atomide.com header.s=25mailst header.b=ZeewQB+j; spf=pass (google.com: domain of linux-kernel+bounces-3085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3085-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DBABB1F21D32 for ; Mon, 18 Dec 2023 07:13:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B5D279E6; Mon, 18 Dec 2023 07:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=atomide.com header.i=@atomide.com header.b="ZeewQB+j" X-Original-To: linux-kernel@vger.kernel.org Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F7DE101CD; Mon, 18 Dec 2023 07:13:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=atomide.com Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id 47712603E6; Mon, 18 Dec 2023 07:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1702883588; bh=W65hS9Wh08vuITZjnUiqgghOncGY2BRKMVeUT9vxU/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZeewQB+jurbCkcW+rsOL1WOjOd7GgIAO+l6eQ+Rp7PO4wI0rfo7aRlTZHXk5jpC5f vCQ6GZZjCPfJL1S9tE9w7Urn9PG4h3ecvXg2rrT/usUSAIHVRB4JWPSWoD5lTC8wsD cRxMmFkWhfPvB5pEj8bz8VA/wRuegwPBSt5njkpVWwCbrBllJmCuSTs8gZrywZN7Pi D9aThgs+valqUI9WjQA3Iypgd/5a3YROZmc1CSKd2ESV7exlbH0jFoX2lBlCy+Hbg3 KYVyAYY7J8gyAQmlo5fCwEtg+Rf2uskKA2gDxWSOfhkE2BAvg/r+OlNvoeVP1JQYV6 qtP8JDEI2m+bQ== From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: "David S . Miller" , Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [RFC PATCH v5 3/6] printk: Flag register_console() if console is set on command line Date: Mon, 18 Dec 2023 09:09:50 +0200 Message-ID: <20231218071020.21805-4-tony@atomide.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218071020.21805-1-tony@atomide.com> References: <20231218071020.21805-1-tony@atomide.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If add_preferred_console() is not called early in setup_console(), we can end up having register_console() call try_enable_default_console() before a console device has called add_preferred_console(). Let's set console_set_on_cmdline flag in console_setup() to prevent this from happening. Signed-off-by: Tony Lindgren --- kernel/printk/printk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2459,6 +2459,9 @@ static int __init console_setup(char *str) if (console_opt_save(str, brl_options)) return 1; + /* Flag register_console() to not call try_enable_default_console() */ + console_set_on_cmdline = 1; + /* Don't attempt to parse a DEVNAME:0.0 style console */ if (strchr(str, ':')) return 1; @@ -3480,7 +3483,7 @@ void register_console(struct console *newcon) * Note that a console with tty binding will have CON_CONSDEV * flag set and will be first in the list. */ - if (preferred_console < 0) { + if (preferred_console < 0 && !console_set_on_cmdline) { if (hlist_empty(&console_list) || !console_first()->device || console_first()->flags & CON_BOOT) { try_enable_default_console(newcon); -- 2.43.0