From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5D631A9F9F for ; Thu, 4 Jun 2026 10:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780568149; cv=none; b=YrwVzXxb7nBL5NqcKaXxbetIB0L7rppSUw3fEC5B+pSTfc8I5JKgU6hPyNWnoFbixAKihkaZ05HXK9gfLeDIrMlE9WjX8f9TSVUhF7ru7T7vjEWpOmlZAIUIl1fQbNLa40KDL+cXg3/vt4Hug0DTSl8Jgd8Dt7+DlNOl0qL+rfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780568149; c=relaxed/simple; bh=PKx+4p2oo7yw9KtyV9BniWGNJqsloScBjEKE1xOhTSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CiabF0k4EijiPO5+0Hfiz/2kNlVNmGXWSPq7aCXJdi57mxnFFJmY+CR4SEmxvT9qP+WVRp3T5P0Ym52HEF54lnY0LUMqHpmpZJDrEOOLL0IdJaYX789iEQLA/UTSaP0fD2nOsz05UAi1Jtmbt30XNCfi+CPbkZ/Kqn+JbucTgpk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=RiwVerEE; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="RiwVerEE" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-45f3cf907ceso250838f8f.2 for ; Thu, 04 Jun 2026 03:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780568146; x=1781172946; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jqnkdv7gOOQHjNT4TjbRQTMZUJtL1maCS95fBdLSvUE=; b=RiwVerEEja1X4gWdvtmUVlJWetJ7RpoxKPnXLmXvNuT9Ef7o/HlH1IWzBVIaFjNhn8 G7NleYuHkaD8s9KmJIKm7ZiuMsSlyDpqHmy2YYPi+WGa16axeW1bj3zJmEW7t2K3etpZ 28TbIICHk2u3jB70weWZ4mWD9xIKTYaiHVMWwYwAl8ncZ/PSik1oU+zeUpTtFQYZ7Z/4 e2euXqCQtWAJmZs+yHIeG33jMqYJPuwc7Yi3DN5ObZ1fYc4Q66UsD+kTdYNl7mYoV26x cOvNdTHyQKKkWIKsXNJREKt26vGDjNd3jTvrBXbHJ+MhWPFE6+4TNVMwgXRf0ZX7w7NJ hAWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780568146; x=1781172946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Jqnkdv7gOOQHjNT4TjbRQTMZUJtL1maCS95fBdLSvUE=; b=q0c3zDK7gdrcbbPFsFyO9uOMP0ZtVmo4Q854iwAMnz8wUHDCU9/MPZ9m1Lai3utJKs 2OdHFJWmmM+EYB24Tbo3xpklSJBJd01kKvXEwX1GV5xFD37pyaXnzqVdEKu835yDdw7t 9WxVHBFIHPeggqtuNqc05yBez/5R0ZIMJPGf/wIQVXvsGNQu8dfu0R3zfRr1NuTBF1dh OuaXUD0NcT8XPNsiJos9kGoKK1ffSnpJtL9+7S+/ofyhLzvcIrgn4QAzmQN1BjugSTPI VEaMDJPwMkQzAuFbiXRQ6+yVT/cRRyLEUnhHnwvtvXMzgqHiWr19RngzpgyNB+1oTuAa 8iUg== X-Forwarded-Encrypted: i=1; AFNElJ8aufhIz+kxgmPkBdZQhiV9rlXMWCla9fCsLo+qLGWeKyFc0QTOxRRKJ2Q09vsd0i5VdAmkjN0pxf5Fauk=@vger.kernel.org X-Gm-Message-State: AOJu0Yxcs0tuv3NBWruRqMYsbQsBWIz7dVdghIov/GGEzUf2f0y/kfYc zaD9cnA7WqAu0EYBIuL6Le2LFDeXFmZgwSsr5qAWEDfHFPOJWwJcYJcP/xQKYJTjhro= X-Gm-Gg: Acq92OHiZ7uPLJofq40S51ulfxrwk1/+cnsqfK8n7pI6XDciHMgluxHooXmpKUpYdye Ui2LAcq5akE7VjOrIN2lEack2okEKGoAEoE1UZ0obXTl3EU/ULjPWC6AjW9QI6AdLwy/56NKSv5 XLDi3YvPu8sgU+bZr40Ph6/8a6scytrLiamPwFUYHvIDDRakRJeOb/o6EUIIx0E0N7sElPVAVFh ZdsxmjFaqahUMeg2cC7uXg0ntkc2vF9w9Rx3/xGqalz0xqQ14n4OmK3VJH/G7CPUfe/bFhapdpz Hcx1lDpJEODVsjzE4bO1BSp47RAJ64KxL0hQG3uJ52CJAXTx6WBseVKRGy71r6dYJuUdUZqq14r qVS88S8B0MHjBxRgfBwoTflq1m4Nlyfc4MEg+zyu2EY+J/bZZlJ1pALqXT3/7Q0aqy6uVLfT6yq xAyaLH4eD728321nZt1qJNr7vTxqjijRNC47jP X-Received: by 2002:a05:600c:5394:b0:490:b0e0:3de2 with SMTP id 5b1f17b1804b1-490b60f9e98mr120597835e9.33.1780568146175; Thu, 04 Jun 2026 03:15:46 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc23394asm59694355e9.0.2026.06.04.03.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 03:15:45 -0700 (PDT) From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Chris Down , Naveen Kumar Chaudhary , linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH v4 03/11] printk: Rename preferred_console to preferred_dev_console Date: Thu, 4 Jun 2026 12:14:50 +0200 Message-ID: <20260604101459.393162-4-pmladek@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260604101459.393162-1-pmladek@suse.com> References: <20260604101459.393162-1-pmladek@suse.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 The preferred_consoles[] array stores information about consoles requested via the command line, SPCR, Device Tree, or platform-specific code. Within this array, the 'preferred_console' variable tracks the specific index that should be associated with /dev/console (typically the last non-braille console defined). The current name "preferred_console" is ambiguous and leads to confusion. It does not clearly communicate why one console is "more preferred" than others in the array. Furthermore, entries for Braille consoles can exist within the preferred_consoles[] array, yet they are never associated with /dev/console and do not receive standard printk() output. Consequently, the 'preferred_console' index must skip these entries, which is not immediately obvious from the name. Rename the variable to 'preferred_dev_console' to explicitly clarify its role in identifying which entry is linked to /dev/console. No behavior change. Signed-off-by: Petr Mladek Acked-by: Chris Down Acked-by: Marcos Paulo de Souza Reviewed-by: John Ogness --- kernel/printk/printk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 0099e46a223b..e162e8836683 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -366,7 +366,7 @@ static int console_locked; static struct preferred_console preferred_consoles[MAX_PREFERRED_CONSOLES]; -static int preferred_console = -1; +static int preferred_dev_console = -1; int console_set_on_cmdline; EXPORT_SYMBOL(console_set_on_cmdline); @@ -2587,7 +2587,7 @@ static int __add_preferred_console(const char *name, const short idx, if ((name && strcmp(pc->name, name) == 0 && pc->index == idx) || (devname && strcmp(pc->devname, devname) == 0)) { if (!brl_options) - preferred_console = i; + preferred_dev_console = i; set_user_specified(pc, user_specified); return 0; } @@ -2595,7 +2595,7 @@ static int __add_preferred_console(const char *name, const short idx, if (i == MAX_PREFERRED_CONSOLES) return -E2BIG; if (!brl_options) - preferred_console = i; + preferred_dev_console = i; if (name) strscpy(pc->name, name); if (devname) @@ -3928,7 +3928,7 @@ static int try_enable_preferred_console(struct console *newcon, return err; } newcon->flags |= CON_ENABLED; - if (i == preferred_console) + if (i == preferred_dev_console) newcon->flags |= CON_CONSDEV; return 0; } @@ -4101,7 +4101,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_dev_console < 0) { if (hlist_empty(&console_list) || !console_first()->device || console_first()->flags & CON_BOOT) { try_enable_default_console(newcon); -- 2.54.0