From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 552933C81A9 for ; Tue, 2 Jun 2026 08:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780390510; cv=none; b=eFCf0QZ/xjWOYc2eehd+SF35K2U0hNv5j1O9B6qTvM4EGfYVBXuc9jOHm/bRgGaoes07Ko1dZEZhe9pOOKArzLJPuJ1PARFT1Up0iOGe20O47LhQoloQd/G0n54tX+PWjwsmOOIKS4yXLMfWUnPBeksJRA1FbbXbyjzGGU3pjnE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780390510; c=relaxed/simple; bh=NriifX9l+AOOXiU9CiR5iqOsLjleHLgKz8nc6t86zj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pB9RFZMqQ7TUY4OYzZpTQPUqoFZTWH1RIbrhWCB6diOr7obYieBR9n5BBxUqNWGetsqbR2eyKja50hKg9Rwk3BU0pyBTB9JOcr0SlsJGyoBCGLFtIW3nz6EVOstrBi4eciDhzn88r3W16U4elprZLfDRjQEkcqNSNVasGtDl24s= 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=Y84cHh0f; arc=none smtp.client-ip=209.85.128.49 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="Y84cHh0f" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-490388fd0dbso111627915e9.0 for ; Tue, 02 Jun 2026 01:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780390508; x=1780995308; 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=n46R3qXfkU7oRMH+JFixKSzY2h+YoJR1acg080JNZZ8=; b=Y84cHh0fya7ziYhD9N/F9ISietl6+0ZtT9eOWt8HEhohh18jQB3C6zK2dHare/hMET rRWOAcS5x+VtZAqiKMqS4kxAhwndTkgRwD6lRSSb+IkiT6OSvaHAvIFJij7leazyDTWc 3Q6paqVLaF5W2Ri09cagSg1VAQKl/SB+TWVPXWtd+ZSlQZSI0C8sa2/LwzrigmtR1k7q VmxoSmR+Zp1+7PPTTCOIzQ90TAD9am4oMiVp0pV9x+CQoGX0eEonR3t45xS1+UFdshSA tgSC1cF4ODvpe6gcsIaPmd53L51jdhvvbBRevr6qTitszuXrCfmgfwX3nxWV9nyiyAAA 2JbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780390508; x=1780995308; 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=n46R3qXfkU7oRMH+JFixKSzY2h+YoJR1acg080JNZZ8=; b=WVaMXGj1q2BgjQge4zSpIyWPkbjLDaHDpkqsUtomCcH1Kx3L7qGzsF7WzwpAO/IGiq C0sln9+Kyu1G13ur153JcPD8lVZrUsszrwyr7Iji15McypTj49K9EKND5CcP3iahp60w 9BN/u+LYYx5hpO/r8ZPgC72MV3y0tJXQdNfV/Z833Q8aWGB8giyiGgNj7raSJukjaWyC +/mUt/r7YUXAMzeaKXypdXm1P0CLpTVSPs4O6XJXeY2mpCHyRa5ZU57nDwYMqdkWvIDp B4KigfXuQ9mKbvqCzizHCCQHa79kr88RaxzEw+kfsX0jzyCJzSVhUxWcEFjsNCyfj6+X aWfQ== X-Forwarded-Encrypted: i=1; AFNElJ+mwe4a21cFRWiDX2JQNiK3Gq2bwZrt0gM2LHsqt/iPVdlP6rT2jbTjjUATgIPJfymVzYfkLwzqJUXvrCc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/3nrCxRV6hu8CgI5XVqoG0gbXVbWN1w41Db4sn72IjhJ9wIEF pMYgZEyicMDLpElEdw81PAyieST1YNcqLxzqDHf3tO0/yjToMB6KlFjnjQnh5SPRbto= X-Gm-Gg: Acq92OGassq0qmpfUqExaVA5hDXhSGhoZ41naq2HS/HZdnPdCwak4qmSPpd1omA0gvH CUSpg8qTtiRTwvuWBSl4C0FXNycEJxyA1KWWKEdtCECAvUf1LybYowgArEJbDBr2/J+hT9/ryWL rLODxW+zXjSKsqD3FcYp6uLrIPFExpufGriy2/U2CjF1b0O1/dHCH1HYts499rb+NrsEXNSZkcR yrnpop94vVd5MHPdspoAWnzFr1mRL3gw9tRpVgTm2D+EzTtoxh42k74MC2V3S/9beIFbKO8puJT MhVJ1gEjjMBofkRhDlng355Kr8kasql5aQhUHbY+CtpaKsg6sGwZ122zZtKTwNEMCG8Cu/XDoY2 Ivric2Jn/a/+StJcbWOWdKcx8qN082fYUL7wKzAfVS75VnyFyuMIFletCtV67qJd2Uufl1ny5+S gD8nWdJ3xOo8HwA6WH/egtDFwCaBgftH+DL1U+yXSPCU+Nfwg= X-Received: by 2002:a05:600c:4f8a:b0:490:afc5:f95d with SMTP id 5b1f17b1804b1-490afc5fb2amr72778495e9.29.1780390507705; Tue, 02 Jun 2026 01:55:07 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490b0e20bacsm50457625e9.6.2026.06.02.01.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 01:55:07 -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 v3 08/11] printk: Do not set Braille console as preferred_console Date: Tue, 2 Jun 2026 10:53:09 +0200 Message-ID: <20260602085312.228251-9-pmladek@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260602085312.228251-1-pmladek@suse.com> References: <20260602085312.228251-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 4a7ecef97b04..97327c27436a 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 @@ -2649,10 +2651,22 @@ static int add_or_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.54.0