From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 CE4D33A4F30 for ; Thu, 23 Apr 2026 13:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776949335; cv=none; b=rNL72g4N3cZahgfOiq1Ee2tIh6oF8Njgb9mbFxQRU1xnWpQCvqGrdM1FxjtQ8h0TOARTmxYSyIJb9NjAyFCMtUWTYWK4XuYJBpEqQuBsPLrhUH8BWTib/KwOdTGlAOMttyP5Ijl/iRaph0HWwOcD9QlUSnUgVzJLRErPCmSDZU4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776949335; c=relaxed/simple; bh=4JAIKsk9xGP9KZ9G9E+SjuE6qjenkCq14DqXaDRnaWs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sMQaRzo3VqDKQSQA7COLgI9svx04SsHf0NqTJ8nXeXnWwT9nokb+XcSTHyz8T4GJXnUVLlDyMaCygPczAKRflva1aKQrJGp2Adjn9Y9oy4Xi/I9j79qy/ZuAqPGR3MJtS9Krldoz7gw2q3UCD/kjdvqqghkuY8spfhrgp9xw9/U= 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=LTixN5No; arc=none smtp.client-ip=209.85.128.52 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="LTixN5No" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4891c0620bcso39797105e9.1 for ; Thu, 23 Apr 2026 06:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1776949332; x=1777554132; 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=f3BDMJ2WjTPc/08h07dFD1R9fzTpSvsDNWyfoYmhEYk=; b=LTixN5NodzvMwdAa9GIHLO7O6i/XVIw9Sjqkw7BuHxOZW7jORjF0hXiqcfAgCHHmk6 tKhIJCaODKZ8/TkS5Gr145T6EDd8qidwIJkoozt8uQ+8VF1H1g765wwAu3exp4rOEhEa hGVA4ce60MEbTCAXnHmQW1rxwaln+GMvVR9fRKrP3Etl4458BZclvgWzdF2kA5inu9gK +GLcwLyEkYOxemfqKpScTEMcJkgIx6Q93S4MbpvbizIULF8eL9i3kBFmVXbGOnb/BUJt g5eRCH7LySyAfIXErmyjrCpq3mk24GyGNmL1FV6e85BfKq6pltXDWeuUUZMKxzrKjdDY IdyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776949332; x=1777554132; 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=f3BDMJ2WjTPc/08h07dFD1R9fzTpSvsDNWyfoYmhEYk=; b=N2vBc8/EBcp7WVl1chOlXSx8gZz5qcDeH5BLJnrDDaycYaL6cGmnCUygQl//ArLzWH cmjr7AfHmQo9MYi2Oz+wVEawepz2h36sW20z5Jz11lPqYsuHkEq+ScfbTK2Vq+GWZK+V S8EkPMMynuvqAjJmf73qZjNf5V/k4ukmv2Dht9QXSvdQ2fQ1GrDwbKUGEhMcaaUYMqv7 A7vQdLxw++Cnw6FVePQUQBTbfd3w/fckyq671C9MvZVPwokkiJD9fF6mpfZfZ9x2L6AD qsItLRmPc/QuULRvcOV6eG2yIqPkPdtot5bWtJURn5aBT+LyNUADpjEpLWpPlqVzPXyL xbog== X-Forwarded-Encrypted: i=1; AFNElJ+tE4V1Cri+NlB4OLQhGXvsDHb5OhBwIcWJ0VD61SvadYfQAMusOB6L8ws3HRMBNI+STKYIQujsCMNj6qY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxpur1Jl3Vs9oatyv1oFYnCww7pNYHM7ojvAweSv05P6k+uNhZI kM12qcLwiB664P+FTy7FuKtYd8prIzu90ULLcFXP5a3ESEi/spGgsSReuP99vQTQE2c= X-Gm-Gg: AeBDiesghA4xuPWIUuGTWByXzQutTwKytNPWVltEs7GeCpW8TwRQVXbipX5hNKwRtuV dQ+pzhmtTyN0txmUcMusjYkfFzwRLm8cpVLO55myggS+YKbmDrnUvmohLxzw/9k6hDOAj9UdS0c Gvr+8EF6VVw20VQGsLUO5sugWIJxzdVg4W22naiWHQiyq1ty58gTtPb2rP/Hu4QUFDCV3Mk4gi/ dC8CFkhnDwLAfCq3+6IjW3+E2qpVnoDa7CuCvRmP7mrbTRIQKGlHIf4+bYe7UE1vqulZQgvqgnV YRTcJv/7F7b9iXYp8UfPZeDrE220Wxw3LkqOc/JAyb0yadLEZkWvX543azsRXZa3ZcVkySHP62t 21Do/lKLjkG3/3r1tYhxptWWvkh+QArJyom+owKnLKCfXi3re8qlmHLVx7XCzHWdIIcL91hecnm tNxqgmlub1ipnqmbg9R1m6rpoVRHfbjI0SPRdd X-Received: by 2002:a05:600c:468f:b0:489:1cd2:610a with SMTP id 5b1f17b1804b1-4891cd2624fmr224994035e9.9.1776949331958; Thu, 23 Apr 2026 06:02:11 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4891cc7b2efsm177988095e9.0.2026.04.23.06.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 06:02:11 -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 7/9] printk: Do not set Braille console as preferred_console Date: Thu, 23 Apr 2026 15:00:12 +0200 Message-ID: <20260423130015.85175-8-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 Braille console reuses the framework for handling consoles preferred via the command line. However, it is a special-purpose interface that neither receives standard printk messages nor associates with /dev/console. Currently, the "preferred_dev_console" variable can point to a Braille console entry in the "preferred_consoles[]" array. This occurs if an entry was first created for a non-Braille console, but a later 'console=' parameter redefined it as a Braille console. Since a Braille console will only ever be enabled as such, it should not be tracked as the primary system console. Adjust the logic to ensure "preferred_dev_console" continues to point to the previously designated normal console instead. Signed-off-by: Petr Mladek --- kernel/printk/printk.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e34955189d16..9143a050c289 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -367,6 +367,7 @@ static int console_locked; static struct preferred_console preferred_consoles[MAX_PREFERRED_CONSOLES]; static int preferred_dev_console = -1; +static int preferred_dev_console_prev = -1; static bool want_braille_console; int console_set_on_cmdline; EXPORT_SYMBOL(console_set_on_cmdline); @@ -2566,10 +2567,11 @@ asmlinkage __visible void early_printk(const char *fmt, ...) * Note that a valid @name and @idx will get assigned later when * @devname matches during the device initialization. * 2. Specify @brl_options if the console should be enabled as - * a Braille console [*] + * a Braille console. * 3. Only matching entries can be updated. * 4. @options passed via the command line are used when the same * console is preferred also by some platform-specific code. + * 5. Braille console is never associated with /dev/console.[*] * * [*] Braille console is using the mechanism for registering consoles * but it is very special. It is primarily used for user interaction @@ -2645,10 +2647,22 @@ static int update_preferred_console(unsigned int i, braille_update_options(pc, brl_options); - if (brl_options) + /* + * The last preferred console should get associated with /dev/console. + * Except for the Braille console which can't get associated with + * /dev/console. One level history should be enough because only one, + * the VisioBraille device, is supported at the moment. + */ + if (brl_options) { want_braille_console = true; - else + if (preferred_dev_console == i) { + preferred_dev_console = preferred_dev_console_prev; + preferred_dev_console_prev = -1; + } + } else if (!is_braille_console_preferred(pc)) { + preferred_dev_console_prev = preferred_dev_console; preferred_dev_console = i; + } /* * @pc console was defined by the user on the command line. -- 2.53.0