From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 1F06036EAAE for ; Thu, 23 Apr 2026 13:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776949261; cv=none; b=vFaB1cvns0KxS5IHaHJ3DDiycXyD3VwyL8RIRMSDS+y4Uk+kZH5TVuCp5nmpFC7/agSkmOWquL7C5gYrmAAvN/h8wyoxl/sUqzfBlsQYFBpo1EUGOWDOp8zDoqf5Rbym/W3KSmR5z1syQWumT0TGSSESGyW/YrVG5O5MnEPjXuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776949261; c=relaxed/simple; bh=y56i9AnUSfG6NW1b3U3RDokjvzgiIPF0zsS76OYJKnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DlCLiZtlgwNmT1gRgHb2cb+8MFkYYQ/Xu8FIGWWO4TvsQStsonKmXv9ogDKII5ah2Ig9QZHJtFkUyYyDBjHfrNA5idPaBDdm+biMyKZDe/twQHiQvX+K4fz1ARdrBYJoEFypDOabVmyFz46QOtpou1WCbhMzqORHtdKNLk8MZR0= 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=a7iXCGHa; arc=none smtp.client-ip=209.85.128.43 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="a7iXCGHa" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4891f625344so51189915e9.0 for ; Thu, 23 Apr 2026 06:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1776949258; x=1777554058; 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=L7bjJ3c/8Y5FLJEd1+CplJ/Vg8Exx1lvA72Z7SAmuRY=; b=a7iXCGHarqT1aXOZRhyjaEsnb0O7JurOBpvLuPw4uJFMDxd4FaEKnA93m6h2LIH3Zc amMqFWzanpHKdnscpHlSZrQrRWQiBxycU+5Vhoa8/F0ZL0I6uNxuYV+sjNePqnskkxgM GbG/KaVKJpGg7O7qzU5BNaAyBrdw3xvJxfL9hUPoiCBj6KrNmwwAAuMpYMcug7MeNCtn r9cAX6u6NmOT5JNR850ypDc/RDxZj+dNcyiTkwgNPItOQW6XC6tJf7464m+SZ9ISrqeC HxVBrJVRu1WhivB7D5Z0ikIMfSiMCs6MeXjJw1gWnnqW2yg5Z+is60NSwpIeG/DhTL+r 2IyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776949258; x=1777554058; 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=L7bjJ3c/8Y5FLJEd1+CplJ/Vg8Exx1lvA72Z7SAmuRY=; b=gQuFpkzRuG6y7ofaLEPeADZnH7xZy6vHLBIjGUxe0jFSR99ZAZ5M3PKPPhaJZ7yZrI nYQntqdmVTIix4migeNVkKyoXxrpwIO8v6Bvcmi9zf1Co9Gkc1lxu7/jzECglUZ/yCdY 7t16P/VUsye45ZwfV26TdjbqG1UtWwvnblSEaG0+a+qbaZzvlv5OUizIQGDgGv9MVnqk tKF42Y+hFP9alQJx4PlnslNA7ne3tgCRrhwrGc6PQnXjWZmQ2HAPfBkY5XOdhgcN7RaA 9JNX1euVcWIk6HloEiNFYUeLs6hOXK3xHJ3ZJ3VyWyy6Q45KOGyk2Wjf4EwU82RTUhJV EWVg== X-Forwarded-Encrypted: i=1; AFNElJ/L/+930zhTp0Jc3FjaItBF+5fHcTpYkGDKTV6Ilrodf+ikqD7nra0To8G9Xab3AKSUT6cutS8DqMoW/9c=@vger.kernel.org X-Gm-Message-State: AOJu0YwmCI/TQt/97QARQSZA8KMu7k2vqBZtsY9okzRfOmE4oxgqr+zX t2q8pE3oxBVO7Cu37AGLQbtUF9LTokc14SxuHp+EkUh/ukPgpTONmtBIn74RT8nswgY= X-Gm-Gg: AeBDievJclC6LQYQ0XHENBqto772ozaNMX0+GGRqVt8LM/k3lYK1V+zcT8PDJh0N4l6 x5wgULxLUQVdhpg2xq4PeeUuVdUY632Z5j1olW+N7iyEnDyd2UW4f1JlnKuqpYf1ZIyzAOpmPV6 b5DzAaQwKqgRzZc3eBQT/yjYRRBRuUPr/iy9L3pD7AZUtHiBqwBt3hvaOB0BKCGfd8UyDso1gnS aYqYolcZZ1rdXWCPpZecpm7MDKXPKPind3GH6+w4wVPuijh3PZgVtn4aBK8/p7cz9gJsrYxB3uQ T68+5ATVPOHdhrDh2PGHtCBPDFdGftwo+zGH9P4k6yHKRdnbRNe4cRfQKIeeLHZqQ5Eo6XrV6Ej vqsbA+K/IV5t+jZMq9irNGKR7mFq4WWSWYjfVd1VilEds1AMFmU4Ca9OAcOaqSXD7xI9pX2r1/f 9P+Ck/T4yCoXrAD73le5moaKO4IE1VlTzSE3ia X-Received: by 2002:a05:600c:4e0c:b0:489:1d7a:4537 with SMTP id 5b1f17b1804b1-4891d7a463emr234222355e9.3.1776949256937; Thu, 23 Apr 2026 06:00:56 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb78d1bcsm228962965e9.5.2026.04.23.06.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 06:00:56 -0700 (PDT) From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Chris Down , linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH v2 2/9] printk: Rename preferred_console to preferred_dev_console Date: Thu, 23 Apr 2026 15:00:07 +0200 Message-ID: <20260423130015.85175-3-pmladek@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260423130015.85175-1-pmladek@suse.com> References: <20260423130015.85175-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. The patch should not change the existing behavior. Signed-off-by: Petr Mladek Acked-by: Chris Down Acked-by: Marcos Paulo de Souza --- 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 ca523acbf58d..13c98285892b 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) @@ -3930,7 +3930,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; } @@ -4111,7 +4111,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.53.0