[PATCH v1 2/2] serial: 8250_port: properly handle runtime PM in IRQ
Andy Shevchenko <[email protected]>
| Newsgroups | gmane.linux.serial,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- drivers/tty/serial/8250/8250_port.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index c0bcc0742a60..01703a707c22 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1880,11 +1880,21 @@ 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