[PATCH v2 2/2] serial: 8250_port: properly handle runtime PM in IRQ

From: Andy Shevchenko

Date: Thu Sep 24 2026 - 08:42:29 EST


We can't and basically don't need to call runtime PM in IRQ handler.
If IRQ is ours, the device must be powered on. Otherwise check if
the device is powered off and return immediately.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/tty/serial/8250/8250_port.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index c0bcc0742a60..1e62460b19ab 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1878,13 +1878,22 @@ EXPORT_SYMBOL_GPL(serial8250_handle_irq);

static int serial8250_default_handle_irq(struct uart_port *port)
{
- struct uart_8250_port *up = up_to_u8250p(port);
unsigned int iir;
+ int pm_status;
+ int ret;

- guard(serial8250_rpm)(up);
+ /* if driver suspended, return, probably shared interrupt */
+ pm_status = pm_runtime_get_if_active(port->dev);
+ if (!pm_status)
+ return 0;

iir = serial_port_in(port, UART_IIR);
- return serial8250_handle_irq(port, iir);
+ ret = serial8250_handle_irq(port, iir);
+
+ if (pm_status > 0)
+ pm_runtime_put_autosuspend(port->dev);
+
+ return ret;
}

/*
--
2.50.1