From nobody Thu Sep 24 17:05:11 2026 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (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 411E13C9EF0 for ; Tue, 22 Sep 2026 07:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790061993; cv=none; b=P79LHydyF+01uiMcHYz7uk0sMZo9iN+vW0sHdowGqoK9INdgUqwk6QRms1GdBgppjcH1CMVs6eB+exkhDq2jNHVBDAJ+vcttUMRPMw3BqB14AmRLJRgJKwFERCpQYVzn0WnmDMmPenipP2ecSkNRPsM4EPUDkV5A3A1/ilReZTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790061993; c=relaxed/simple; bh=UIeHGzko9PNGSAFX4WTjAsYcLZre5mbCyVd5/P2jJGM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eNGLxLtoSWGQeUUOv1MGr1NjcPZKdUMfypdTq2nWGEke1HFnU8A8WkuhYDyEhH6NDV3mhDVPjiW09eH1BzkarU5ELVh7lI6ZOnCvGLcGL8jlSd8rDkYv9FhSlWaXm1aGN0JH3PYTpy9ZkBGEx9BWgnbub7NpMzgKvJk0LKspkOw= 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=EqBghxV6; arc=none smtp.client-ip=74.125.225.140 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="EqBghxV6" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49b912d37b6so18053695e9.0 for ; Tue, 22 Sep 2026 00:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1790061990; x=1790666790; 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:content-type; bh=fnhbPdt7hfIV/6LXnAHz3D7CDaGQANxV0Uyd8rSU9Jg=; b=EqBghxV6CGX4X/gdDMrUese0eongaoXz+uf4DrLhsIvF+D9cbZwCWREx8a4SyotJh/ T6T5jAhCrxi9/hg4CYrTaz1hNKeKkARMmHLk+aZ2WrIz23DqGMt0yQO7PEuYIzRfXKJR jKIZ9zuXsUQhjtlfCc/TUOp4xYeklNMzQv2c/Qxv8GD2bSHt6vaD6ZhhwYpcVb5UOR2b 8zrMV+/8SZX1DbkGHYZz5dg/kcr90DPTV+w9+3+j07j0O5QCt9G1YfklsOBknRXTQREY yIBxIBA0GWV6eCI/crWOZJ0+63Dw/cvTxf2mRsNJuS9n1P+yQ43Y1HzHxE2MXaT0n/93 issw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790061990; x=1790666790; 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:content-type; bh=fnhbPdt7hfIV/6LXnAHz3D7CDaGQANxV0Uyd8rSU9Jg=; b=v+VkPxd6YG9wTW+vjdfhLjNNKSNN+3aPZRs833ccE5Uti/+OF6DH8OC4HbPw7/fsFF yuXs0qItEfudpQFP/s81X+WWJjN9MoaztL6nH3P7rl1quGQ2AQy6/yZS5OU9VErYmUHq eUATm5Q7z+W96bGb+W0R7Hag20mRLBEOgsxAtgVGeCUFche14er3zkrS05t8R+yZFc0g jepS8gKrIsv2Ury9OEHY1IjDjx0aAPizKG1OXkm99lnitaOxk3juyzDv7iAYcN7+e6LR hqu5cw+2jeWD8IYXl7I6DTTN4hHmSRqXGmCkpuqE00FVAHnCZA/oZmMprrTfxVAtUIav WAJA== X-Forwarded-Encrypted: i=1; AKwUvBwZtWPJHxhffwMEHM71e8o4bT5YWR0TTMUK/1BCDkeL6RuofFlrhblMGPaA45Y08wmLo1viJ0cftndFnX4=@vger.kernel.org X-Gm-Message-State: AFuF++k+Z3Kq6m33zAYXfBKANFcdQyqhswq6cUz7ExOq5B1vdtZ+4/aF yb6O/9w1/4MpZ9QpPwYUq6hwhS/QDbXwcaiKXVLHkpwpPadu/mFM5FfgCChrpbdez/E= X-Gm-Gg: AYBFou0m6mJ3CakuI/P7A9TgslXPMAIQx7IWc9R4fRhSGPopd1rVhzwtasCsP4jlIaN epcoJwKOMxcUcg02KmdleFT306wk+QCBLUt5CSen6LCNFJ/Z+t8U4+9WLYIe3HGOQGP0By1EDdj yKHnfwOKgumHvJsfSAlg/VfHu1SweosMfqyEIatFAlBvcIm9GC8jJfs4axfsiZvNYhcaEcT8+Zp KgIpYA4hMyReQBEf4cENufU8hu2IodyVnKtGzA/d5AwluuVrJxkUXb95dM0+1Mr0HSzAmMKl0i6 VjGNETyxe0aTVRndsK21UaKaF/8xKaHhKPOiVbKrDYBzac6j6pQYMh6Z7wGhH+/1HtvI7oOIfgb 5S751OeoOlPg6giMkjaVq1Ifm2Gj+N/vSQzrGxFUtEeb/f54U+19b8ROlmZuw6OZvG8SE23IFax kBCvVwV09tfMW52nBlpVNxu5HAXnBlDLuB5uK/LU/nSZOgBdMc2IfIwwyvvIz4rNRx+aE2zDeA X-Received: by 2002:a05:600c:c0c3:10b0:49e:823a:9dec with SMTP id 5b1f17b1804b1-49fc5a10b5fmr167223725e9.3.1790061990534; Tue, 22 Sep 2026 00:26:30 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fd8cc05e9sm52966385e9.5.2026.09.22.00.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 00:26:30 -0700 (PDT) From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Samuel Thibault , Greg Kroah-Hartman , Jiri Slaby , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Hugo Villeneuve , Fushuai Wang , Kees Cook , Stepan Ionichev , linux-serial@vger.kernel.org, Manuel Lauss , linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH 1/2] printk: nbcon: Introduce Braille helpers Date: Tue, 22 Sep 2026 09:25:57 +0200 Message-ID: <20260922072558.98854-2-pmladek@suse.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260922072558.98854-1-pmladek@suse.com> References: <20260922072558.98854-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: quoted-printable Content-Type: text/plain; charset="utf-8" These helpers will be used when calling console->write_atomic in the Braille console driver. The Braille console is not registered as a standard printk console. Instead, it is integrated with the virtual terminal (VT) and writes data using the legacy con->write() callback of the associated serial console driver. When the underlying console driver is converted to the NBCON API, the Braille console needs to use the con->write_atomic() callback instead. This callback must be synchronized by acquiring the nbcon console context. Fixes: d3539347022a ("serial: 8250: Switch to nbcon console, take 2") Signed-off-by: Petr Mladek --- include/linux/console.h | 8 ++++++ kernel/printk/nbcon.c | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/include/linux/console.h b/include/linux/console.h index 502d1abe3f50..d780f6de303a 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -615,6 +615,10 @@ extern bool nbcon_allow_unsafe_takeover(void); extern bool nbcon_kdb_try_acquire(struct console *con, struct nbcon_write_context *wctxt); extern void nbcon_kdb_release(struct nbcon_write_context *wctxt); +extern bool nbcon_is_braille(struct nbcon_write_context *wctxt); +extern bool nbcon_braille_try_acquire(struct console *con, + struct nbcon_write_context *wctxt); +extern void nbcon_braille_release(struct nbcon_write_context *wctxt); =20 /* * Check if the given console is currently capable and allowed to print @@ -678,8 +682,12 @@ static inline void nbcon_reacquire_nobuf(struct nbcon_= write_context *wctxt) { } static inline bool nbcon_kdb_try_acquire(struct console *con, struct nbcon_write_context *wctxt) { return false; } static inline void nbcon_kdb_release(struct nbcon_write_context *wctxt) { } +static inline bool nbcon_is_braille(struct nbcon_write_context *wctxt) { r= eturn false; } static inline bool console_is_usable(struct console *con, short flags, bool use_atomic) { return false; } +static inline bool nbcon_braille_try_acquire(struct console *con, + struct nbcon_write_context *wctxt) { return false; } +static inline void nbcon_braille_release(struct nbcon_write_context *wctxt= ) { } #endif =20 extern int console_set_on_cmdline; diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index d17704fe93ae..a5e053ffe4da 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -2002,3 +2002,62 @@ void nbcon_kdb_release(struct nbcon_write_context *w= ctxt) */ __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb)= ); } + +/** + * nbcon_is_braille - Checks whether the nbcon write context is using Brai= lle console + * + * @wctxt: checked nbcon write context + * + * Return: True when the write context is associated with a Braille consol= e. + * Othrewise, return false. + * + * Context: Can be called in any context but only when Braille console is + * registered and the struct console could not disappear. + */ +bool nbcon_is_braille(struct nbcon_write_context *wctxt) +{ + struct nbcon_context *ctxt =3D &ACCESS_PRIVATE(wctxt, ctxt); + struct console *con =3D ctxt->console; + + return con && con->flags & CON_BRL; +} + +/** + * nbcon_braille_try_acquire - Try to acquire nbcon console for braille_wr= ite() + * + * @con: The nbcon console to acquire + * @wctxt: The nbcon write context to be used on success + * + * Context: braille_write() for emitting a single buffer on Braille consol= e. + * + * Return: True if the console was acquired. False otherwise. + * + * Braille console is not registered as a proper printk consoles. Instead, + * it is integrated with the graphical virtual terminal. + * + * This function acquires the nbcon console using priority NBCON_PRIO_EMER= GENCY. + */ +bool nbcon_braille_try_acquire(struct console *con, + struct nbcon_write_context *wctxt) +{ + struct nbcon_context *ctxt =3D &ACCESS_PRIVATE(wctxt, ctxt); + + memset(ctxt, 0, sizeof(*ctxt)); + ctxt->console =3D con; + ctxt->prio =3D NBCON_PRIO_EMERGENCY; + + return nbcon_context_try_acquire(ctxt, false); +} + +/** + * nbcon_braille_release - Release the nbcon console + * + * @wctxt: The nbcon write context initialized by a successful + * nbcon_braille_try_acquire() + */ +void nbcon_braille_release(struct nbcon_write_context *wctxt) +{ + struct nbcon_context *ctxt =3D &ACCESS_PRIVATE(wctxt, ctxt); + + nbcon_context_release(ctxt); +} --=20 2.55.0 From nobody Thu Sep 24 17:05:11 2026 Received: from mail-wr2-f37.google.com (mail-wr2-f37.google.com [74.125.225.101]) (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 7A08F3839AC for ; Tue, 22 Sep 2026 07:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790062006; cv=none; b=V3O7ZlhoPFmRUfJCot2OvMe4xppAD1oWEYnkdBuF9DPvMY3kUK/ZAp9ATw0POttXVWYVj1ZMh5ClLi3UbFBYmME3gNHGFcQg/1ahXd6C+igauzKSB4NaIxuJ/PwbjOf8nW+gLcoZNt+8s46cwOLKOJqn0AoRIZuLy98eK/v40Wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790062006; c=relaxed/simple; bh=4Z62Xv5PMHnfdSbbUYiP/gr3VyxZoYSTSx4wDC2uPe8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b8JMQvO672XH7AQiiLzWLQXnKNjfY2RzoKGVhVSPaKOV0yI0sfThV+4GLIZKgEF+sA9jYfHJESTI5MGa8o8mlVqH7dW5KYazWceT5nFxK1pG5IHrUyCuUDSPDAf8NoagyKajx48xIMJBDmHEUcTyv3MZ57jPErLq7YbaNdOgkz0= 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=RfVhhZr/; arc=none smtp.client-ip=74.125.225.101 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="RfVhhZr/" Received: by mail-wr2-f37.google.com with SMTP id ffacd0b85a97d-482f6356f6bso2912686f8f.2 for ; Tue, 22 Sep 2026 00:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1790062003; x=1790666803; 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:content-type; bh=mijCsOeT4dW/QaoqrTcbYmQViveRxBniaswO81wBCMI=; b=RfVhhZr/6f/blD4HsgpAaq+LoKZI+yFQh38j8flKgtzR7KwCF/rwHFfuNmEMs5kxKr aZ+RLgpc/bS7sdsLKzw4MvgRtKKFiP480nivJ4VQJEoPJIHppz1+mWgwn3UFHZEZ6iWc bmCRk4JNTjO5zgczDAhpbL57XkHbbuaJusDUIEeWPt6hCtvaUhoBo5LX5zlZyZP6eumh cC/Tqu0fRWn3583Qvws4c/1vXs+fhNLpN9UQ5URuipO/sVnTdIRkdy51PQ9UOw8X2eRZ 7TrVBs/RMpBHMfcckSttRyln2ayR7YXl8eYTXjLVa1gR4C+8OdLoI+A2oo8hWjYJJoT4 VG4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790062003; x=1790666803; 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:content-type; bh=mijCsOeT4dW/QaoqrTcbYmQViveRxBniaswO81wBCMI=; b=tnINWNS/T6gG/e7wjhfUQPrHvA88OgYhakXqVFRS6YFr0Y1svjF8ltw9BSUIDTYSxH ytUoRNg3K+BnHicjogJJb6HfpA4zx3ecg6FsonhjhffOYFPw6wD0C+hlmr4ihZeLbrhO zndlzJZOguVJ3Yx1d5MAgr2gHjp4tJXLIeIOvPB3XQfsFRujG8LFEEG+IyIEAyBZBNiT OTeSUmbQripuoev1eMgS+xU8w3Z0cfhZaZ0oxvEnEyUQ4Fxjnb0asxs2xF03E6OOL+np frfBoMiVZqmXh/4uBU6b+dSPdYBzUysi0pux7Byt2WFweW98oEe3U41OwWy4O+zKC/8e m1+w== X-Forwarded-Encrypted: i=1; AKwUvBzXJtlhI6xB5SAtGsb8OVu1nZYEULNLv/j0odwy3V3eevttCwPnOQgJM4XlIYAUNwiOoISPV7cDxws/Cyg=@vger.kernel.org X-Gm-Message-State: AFuF++ntxisotjNjd/d2J5sk7LbEn5VmrbPBlCPXhXdEgd3H5kf133jI /Cn8TgUd5J2CrNqHAFjZ8kQaY77YvT8ouKXlvfQTYLso9J4O8TfL9mCLV3oIkOET1CQ= X-Gm-Gg: AYBFou0X4du6cquovPhDMPjpGOD9wbXN5dOlblcZxGukssHXSg2yZymyHtM/uxxnj+e 1y0mRi2DcmxTkI1qE5oy+o9bjPxeL8gepRGJwPpEwwTAb0S5WSJi38UWg3eHhAa3FAHA9NrjgEt BQunJDJlpQ3y5X6OhYGBZec3SGNZlApwX72CunQVJb6JtfnxNImUCoV2LoPhGsr16ws0CFB1RCR 0Nqoy4gqFvp8Jq7rkaElt8/6k9T17Gd/ykPo7RsgM86Q51Z1wXLTwt6l+eWrAWxxtt/elW1SZ0J +mQpFea9IuPquHdmTOVfuJy37jMrHn+FpdJRYb+AtNADco+BZofaSDRb5SSZt7Qx4Zpd+nJqxlk ysJESgrgW2L6X68tVb0YXG40L2IMw022jasH0PPacNzFhlt7/iv/JDiFarWIUemeXgm6LMbCRvw oI8It/kZdfWLZDtsbhFLavxMH7GJuIf42rckVIGe5645Ue9brZrpklGHpyJvylrdHB2fiqBA5o X-Received: by 2002:a05:6000:38f:b0:487:27f9:83d with SMTP id ffacd0b85a97d-48727f90ba9mr11598775f8f.50.1790062002655; Tue, 22 Sep 2026 00:26:42 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48862773ff0sm2915327f8f.9.2026.09.22.00.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 00:26:42 -0700 (PDT) From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Samuel Thibault , Greg Kroah-Hartman , Jiri Slaby , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Hugo Villeneuve , Fushuai Wang , Kees Cook , Stepan Ionichev , linux-serial@vger.kernel.org, Manuel Lauss , linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH 2/2] braille: nbcon: Use nbcon atomic console callbacks Date: Tue, 22 Sep 2026 09:25:58 +0200 Message-ID: <20260922072558.98854-3-pmladek@suse.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260922072558.98854-1-pmladek@suse.com> References: <20260922072558.98854-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: quoted-printable Content-Type: text/plain; charset="utf-8" The Braille console is integrated with the virtual terminal (VT) and writes its data using the legacy con->write() callback of the associated serial console driver. However, once the underlying console driver is converted to the NBCON API, it should use the con->write_atomic() callback, which must be synchronized by acquiring the nbcon console context. Adapt braille_write() to handle NBCON consoles: 1. Acquire the nbcon console ownership using NBCON_PRIO_EMERGENCY priority before printing, disabling local interrupts to prevent any nested calls into the driver. 2. Call the con->write_atomic() callback to write the buffer. 3. Release the nbcon console ownership and restore local interrupts. Also, adjust __serial8250_console_write() in the 8250 serial driver to exclude Braille consoles from the newline prepending logic. The serial port is not used for standard printk logging which might be interrupted in the middle of the operation. In the Braille mode, the serial driver is supposed to write exactly what it gets. In fact, it does not print any newlines at all in this case. Fixes: d3539347022a ("serial: 8250: Switch to nbcon console, take 2") Signed-off-by: Petr Mladek --- .../accessibility/braille/braille_console.c | 38 ++++++++++++++++++- drivers/tty/serial/8250/8250_port.c | 5 ++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/acce= ssibility/braille/braille_console.c index 06b43b678d6e..cd1019d478db 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c @@ -62,14 +62,32 @@ static void braille_write(u16 *buf) { static u16 lastwrite[WIDTH]; unsigned char data[1 + 1 + 2*WIDTH + 2 + 1], csum =3D 0, *c; + struct nbcon_write_context wctxt =3D { }; + unsigned long flags; + u16 out; int i; =20 if (!braille_co) return; =20 + if (braille_co->flags & CON_NBCON) { + /* + * Braille console might be called from unknown context via + * vt_console_print() from console_unlock() from printk(). + * Use the atomic callback and synchronize it just using + * the console context. Disable interrupts to prevent a nested + * call into the driver code which might cause a deadlock when + * trying to acquire the console ownership, see + * __nbcon_atomic_flush_pending_con(). + */ + local_irq_save(flags); + while (!nbcon_braille_try_acquire(braille_co, &wctxt)) + cpu_relax(); + } + if (!memcmp(lastwrite, buf, WIDTH * sizeof(*buf))) - return; + goto release_nbcon; memcpy(lastwrite, buf, WIDTH * sizeof(*buf)); =20 #define SOH 1 @@ -102,7 +120,23 @@ static void braille_write(u16 *buf) *c++ =3D csum; *c++ =3D ETX; =20 - braille_co->write(braille_co, data, c - data); + if (braille_co->flags & CON_NBCON) { + if (braille_co->write_atomic && + !braille_co->flags & CON_NBCON_ATOMIC_UNSAFE) { + nbcon_write_context_set_buf(&wctxt, (char *)data, c - data); + braille_co->write_atomic(braille_co, &wctxt); + } else { + pr_warn_once("Braille requires a safe braille_co->write_atomic callback= \n"); + } + } else { + braille_co->write(braille_co, data, c - data); + } + +release_nbcon: + if (braille_co->flags & CON_NBCON) { + nbcon_braille_release(&wctxt); + local_irq_restore(flags); + } } =20 /* Follow the VC cursor*/ diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 38fa45e74a37..6eb0b439e433 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3417,8 +3417,11 @@ static void __serial8250_console_write(struct uart_8= 250_port *up, * If the console printer did not fully output the previous line, it * must have been handed or taken over. Insert a newline in order to * maintain clean output. + * + * Braille consoles are an exception. The serial port is not used + * for printk(). The driver is supposed to write exactly what it gets. */ - if (!up->console_line_ended) { + if (unlikely(!up->console_line_ended && !nbcon_is_braille(wctxt))) { if (use_fifo) __serial8250_console_fifo_write(up, wctxt, "\n", 1); else --=20 2.55.0