Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp221566lqe; Wed, 27 Mar 2024 04:03:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWINJVt7zQJCgVEsBVydU8+CcloAN0yHR7o2W3TnVfZRrjKBJ6zcbvxF+J8wLviMoqyK9IwZxwSxyz/ih0Qzexvb7vb8+3QFBRlAGvCqg== X-Google-Smtp-Source: AGHT+IFU71W83LuXmXLwug5W1ybFWgxDi56lCwvEakktEISBPhiqryJjJxZMYWT/VuPBoXkYrodV X-Received: by 2002:a05:6214:104f:b0:696:a202:5f53 with SMTP id l15-20020a056214104f00b00696a2025f53mr2966591qvr.49.1711537415109; Wed, 27 Mar 2024 04:03:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711537415; cv=pass; d=google.com; s=arc-20160816; b=kLkUd5TuqVWmAmg0GsQt7XWP1vjjuKe2XxEpA5WORISHcVEkZdbdTaEOlm9HIFDVEG SGTiLJcE4gk+Td1MlKCWUp34Dlr/AUKwGlOg2wGtHG+M2hoJiPaTBGmXf7uzmFugR5// PYuFfQyKpd+a4ImpvsHAXEpaFES4TgZwoYvZV/s0mBZKYC4bcB883bRiqBT2KWmORiZw D2lAThUqbe6SkQL+n2wiLM/xmQKLc/ZeywfjCLm2/XgUZmpsT5KHy5IXVwNBLNUy52J0 hVPKLeP6aXGqnY7N2la5yh+oKSoE0aihwc8CWlgIHyXF659LKyutBYEChgSM98LEEskv XnPQ== ARC-Message-Signature: i=2; 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=YGgcdjoUCJEYYhozLmN9oSyjtefKYzQXZ4bZ9ebtaKI=; fh=qZjR4FRzCammr0y4Ol3QkScLI4wemh+oQYE39x5b6TU=; b=yXFAF/QRYs23nJz8aIXQCIQ2FqI0IbgHmNHMTvZ1UO6AaIoHCo8R1F7Wz0grZh/rjE cTkXMheJXZRJVV6vpO4hG919QJY68l84or2RmTDL5QnJ7AqCJIwb6txEN0ewyFxHqbGj lrB/qworVrvM/B30EWCkcoaJkDzYKeLJ+6AxOhAR7hF1yIi4pp+KH+kdKoFXljtawSLf b8dJlE/JuROigny1KorZR4IvdAXqnBDv6fy7WkfslZSBDsp1XTeLAYtz6oDs+MNNPKnI Kt5Ft4ZhKc/LGd77npz25ea4zt5Ypymhni7smqm0TT97cs3uBDxCqUrcqRzYn8C3F381 8kYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@atomide.com header.s=25mailst header.b=bjPfJkNR; arc=pass (i=1 dkim=pass dkdomain=atomide.com); spf=pass (google.com: domain of linux-kernel+bounces-120714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120714-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u11-20020a0562141c0b00b00690b67ee92asi12292402qvc.460.2024.03.27.04.03.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 04:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@atomide.com header.s=25mailst header.b=bjPfJkNR; arc=pass (i=1 dkim=pass dkdomain=atomide.com); spf=pass (google.com: domain of linux-kernel+bounces-120714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120714-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D36601C27A49 for ; Wed, 27 Mar 2024 11:03:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B34D02C6A6; Wed, 27 Mar 2024 11:03:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=atomide.com header.i=@atomide.com header.b="bjPfJkNR" 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 6D38454760; Wed, 27 Mar 2024 11:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.50.62.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711537404; cv=none; b=fLZRzo+h1qY6HL8X+9GN1OGOnc/iTzq3lxjTwkggfQrYzMGgQqlp4ha5LnqF0mweg8C34r6DVeNfi5L7GgB9e48iEoKQeP+LAxB+g9SGXXtEb27oZ4/sUhwFU1gMsElQh4zboD+uofQu//gGTc9GC6soZI4oh2T9/9xI+1GoPL0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711537404; c=relaxed/simple; bh=vUly8NV1gJ6HwWIMN43IuZorZ85oWvydp9mvQMeOnUs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YwbeGGBsgfGBJ8S8AgGzpWMVZ/6JwDKOzlKoxTkKEzswcHXQiyFAIy/Nn9277r9IKdGgZVJsTUeac2ZFcDOMi58L93u8Aj8lo+hb/vxfifIWalkKW085DTstnvTvbdSoWqmJHvfuADN30Th1wb0cedyNYjVnhQ6VmHhE3izqb9I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com; spf=fail smtp.mailfrom=atomide.com; dkim=pass (2048-bit key) header.d=atomide.com header.i=@atomide.com header.b=bjPfJkNR; arc=none smtp.client-ip=74.50.62.9 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 BF050604C8; Wed, 27 Mar 2024 11:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1711537402; bh=vUly8NV1gJ6HwWIMN43IuZorZ85oWvydp9mvQMeOnUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjPfJkNRpv5ngZ2eGer1lsoLomOM7dTQfZAUJ8L6WksEX0Pzjoh2tIVyXQZ56QrLd BMBBV6TOSf1ouheIxqZp2smMRTkEXoezDnOd0lexQk4MxtK1gy3n0d4PoHffrdYl2p Lo2eX71v4VtFoOHwUGPpoQXp66UtzhNG7oeg84QVvfkBSKxAV/kZaWOdluIQjgKkUs ZpuVuk+gvVQpjV6gr+AlWGAYF77u42YTgzEHB3+vWFw1K36hg3Dfkuk+vSP+24sUNP XKurHZtVnH3K2FiyHqdw0k9urpYRaaLnELZmCJM5WCXtDG7N6nnch9OFdwdxIlzqz0 aAs0Mmem5STYA== From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Jonathan Corbet , 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, Sebastian Reichel , linux-doc@vger.kernel.org Subject: [PATCH v7 3/7] printk: Flag register_console() if console is set on command line Date: Wed, 27 Mar 2024 12:59:37 +0200 Message-ID: <20240327110021.59793-4-tony@atomide.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327110021.59793-1-tony@atomide.com> References: <20240327110021.59793-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 @@ -2498,6 +2498,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; @@ -3501,7 +3504,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.44.0