From: "Ionut Nechita (Wind River)" <ionut.nechita@windriver.com>
To: ilpo.jarvinen@linux.intel.com, gregkh@linuxfoundation.org
Cc: stable@kernel.org, andriy.shevchenko@linux.intel.com,
wander@redhat.com, chris.friesen@windriver.com,
linux-serial@vger.kernel.org,
"Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
Ionut Nechita <ionut.nechita@windriver.com>
Subject: [PATCH v2 6.12.y 04/10] serial: 8250: convert serial8250_do_shutdown() to scoped_guard()
Date: Wed, 13 May 2026 09:50:22 +0300 [thread overview]
Message-ID: <20260513065028.112468-5-ionut.nechita@windriver.com> (raw)
In-Reply-To: <20260513065028.112468-1-ionut.nechita@windriver.com>
From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
This is a partial backport of upstream commit b339809edda1 ("serial:
8250: use guard()s"). Only the serial8250_do_shutdown() hunks of
drivers/tty/serial/8250/8250_port.c are taken; the rest of the
upstream commit is not needed for the BUSY deassert series.
This conversion is a textual prerequisite for applying
commit 59a33d83bbe6 ("serial: 8250: Protect LCR write in shutdown")
without conflicts, because that commit moves the LCR write into a
scoped_guard(uart_port_lock_irqsave) block that does not yet exist
in 6.12.y.
This depends on commit 0fd60b689b0d ("serial: introduce
uart_port_lock() guard()s") (also backported in this series) which
introduces DEFINE_LOCK_GUARD_1(uart_port_lock_irqsave, ...).
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250814072456.182853-10-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[Ionut: partial backport - only the serial8250_do_shutdown() hunks
from b339809edda1, per Ilpo's guidance to take "8250_port.c shutdown
hunks" from that commit; the remaining hunks are not required for
the BUSY deassert series.]
Signed-off-by: Ionut Nechita <ionut.nechita@windriver.com>
---
drivers/tty/serial/8250/8250_port.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index b4c8388ea6fc..21fa7907c0d6 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2461,7 +2461,6 @@ static int serial8250_startup(struct uart_port *port)
void serial8250_do_shutdown(struct uart_port *port)
{
struct uart_8250_port *up = up_to_u8250p(port);
- unsigned long flags;
serial8250_rpm_get(up);
/*
@@ -2469,26 +2468,26 @@ void serial8250_do_shutdown(struct uart_port *port)
*
* Synchronize UART_IER access against the console.
*/
- uart_port_lock_irqsave(port, &flags);
- up->ier = 0;
- serial_port_out(port, UART_IER, 0);
- uart_port_unlock_irqrestore(port, flags);
+ scoped_guard(uart_port_lock_irqsave, port) {
+ up->ier = 0;
+ serial_port_out(port, UART_IER, 0);
+ }
synchronize_irq(port->irq);
if (up->dma)
serial8250_release_dma(up);
- uart_port_lock_irqsave(port, &flags);
- if (port->flags & UPF_FOURPORT) {
- /* reset interrupts on the AST Fourport board */
- inb((port->iobase & 0xfe0) | 0x1f);
- port->mctrl |= TIOCM_OUT1;
- } else
- port->mctrl &= ~TIOCM_OUT2;
+ scoped_guard(uart_port_lock_irqsave, port) {
+ if (port->flags & UPF_FOURPORT) {
+ /* reset interrupts on the AST Fourport board */
+ inb((port->iobase & 0xfe0) | 0x1f);
+ port->mctrl |= TIOCM_OUT1;
+ } else
+ port->mctrl &= ~TIOCM_OUT2;
- serial8250_set_mctrl(port, port->mctrl);
- uart_port_unlock_irqrestore(port, flags);
+ serial8250_set_mctrl(port, port->mctrl);
+ }
/*
* Disable break condition and FIFOs
--
2.54.0
next prev parent reply other threads:[~2026-05-13 6:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 6:50 [PATCH v2 6.12.y 00/10] serial: 8250_dw: backport BUSY deassert series Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 01/10] serial: 8250: use serial_port_in/out() helpers Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 02/10] serial: 8250_dw: Comment possible corner cases in serial_out() implementation Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 03/10] serial: introduce uart_port_lock() guard()s Ionut Nechita (Wind River)
2026-05-13 6:50 ` Ionut Nechita (Wind River) [this message]
2026-05-13 6:50 ` [PATCH v2 6.12.y 05/10] serial: 8250: Protect LCR write in shutdown Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 06/10] serial: 8250_dw: Avoid unnecessary LCR writes Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 07/10] serial: 8250: Add serial8250_handle_irq_locked() Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 08/10] serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 09/10] serial: 8250_dw: Rework IIR_NO_INT handling to stop interrupt storm Ionut Nechita (Wind River)
2026-05-13 6:50 ` [PATCH v2 6.12.y 10/10] serial: 8250_dw: Ensure BUSY is deasserted Ionut Nechita (Wind River)
2026-05-13 10:16 ` [PATCH v2 6.12.y 00/10] serial: 8250_dw: backport BUSY deassert series Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260513065028.112468-5-ionut.nechita@windriver.com \
--to=ionut.nechita@windriver.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=chris.friesen@windriver.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=stable@kernel.org \
--cc=wander@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox