* [PATCH] serial: 8250: release the transmit PM reference on shutdown
@ 2026-10-22 17:16 James Hilliard
2026-10-22 17:25 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2026-10-22 17:16 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Raul E Rangel, Ilpo Järvinen,
Andy Shevchenko, Heikki Krogerus, Tony Lindgren,
Sebastian Andrzej Siewior
Cc: linux-kernel, linux-serial, James Hilliard
Transmit holds a runtime PM reference until the transmitter-empty path
clears THRI. A hangup can shut down the port while that reference is still
held. Shutdown clears the interrupt enables and stops DMA, leaving no TX
interrupt to release rpm_tx_active. A suppressed DMA completion cannot
release it either.
Drop the transmit reference after shutting down TX in both the generic
and OMAP shutdown paths. Their separate shutdown PM references keep the
UART accessible throughout cleanup. The exchange in the helper also
handles shutdown after the normal TX path already released its reference.
Fixes: d74d5d1b7288 ("tty: serial: 8250_core: add run time pm")
Reported-by: Raul E Rangel <rrangel@chromium.org>
Closes: https://lore.kernel.org/r/20261022152019.1621716-1-rrangel@chromium.org
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/tty/serial/8250/8250.h | 1 +
drivers/tty/serial/8250/8250_omap.c | 1 +
drivers/tty/serial/8250/8250_port.c | 5 ++++-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 21ed9c41b751..4a7d26e2dbf0 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -190,6 +190,7 @@ void serial8250_wait_for_xmitr(struct uart_8250_port *up, int bits);
void serial8250_rpm_get(struct uart_8250_port *p);
void serial8250_rpm_put(struct uart_8250_port *p);
+void serial8250_rpm_put_tx(struct uart_8250_port *p);
DEFINE_GUARD(serial8250_rpm, struct uart_8250_port *,
serial8250_rpm_get(_T), serial8250_rpm_put(_T));
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 29a203ed93fd..bb6c312c8cdf 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -795,6 +795,7 @@ static void omap_8250_shutdown(struct uart_port *port)
if (up->lcr & UART_LCR_SBC)
serial_out(up, UART_LCR, up->lcr & ~UART_LCR_SBC);
serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
+ serial8250_rpm_put_tx(up);
}
static void omap_8250_throttle(struct uart_port *port)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index db066a42f61d..76f35d1b3203 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -672,7 +672,7 @@ static void serial8250_rpm_get_tx(struct uart_8250_port *p)
pm_runtime_get_sync(p->port.dev);
}
-static void serial8250_rpm_put_tx(struct uart_8250_port *p)
+void serial8250_rpm_put_tx(struct uart_8250_port *p)
{
unsigned char rpm_active;
@@ -684,6 +684,7 @@ static void serial8250_rpm_put_tx(struct uart_8250_port *p)
return;
pm_runtime_put_autosuspend(p->port.dev);
}
+EXPORT_SYMBOL_GPL(serial8250_rpm_put_tx);
/*
* IER sleep support. UARTs which have EFRs need the "extended
@@ -2486,6 +2487,8 @@ void serial8250_do_shutdown(struct uart_port *port)
*/
synchronize_irq(port->irq);
+ /* TX interrupts can no longer release the transmit reference. */
+ serial8250_rpm_put_tx(up);
serial8250_rpm_put(up);
up->ops->release_irq(up);
---
base-commit: 1184f87e2790e8af9be3116f608d2e86b4792d7d
change-id: 20261022-submit-serial-8250-tx-pm-shutdown-v1-db9091dde8f7
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-22 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22 17:16 [PATCH] serial: 8250: release the transmit PM reference on shutdown James Hilliard
2026-10-22 17:25 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.