From: Andy Shevchenko <andriy.shevche...@linux.intel.com>

Backport:
 - Upstream-status: Pending.
 
[https://bitbucket.org/andy-shev/linux/commits/8d89f5c7fa087bb72104070667330288714000d0?at=master]

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

Signed-off-by: Andy Shevchenko <andriy.shevche...@linux.intel.com>
---
 drivers/tty/serial/8250/8250_port.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c 
b/drivers/tty/serial/8250/8250_port.c
index 56ccbce..342e2f1 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1581,17 +1581,19 @@ 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 ret;
 
-       serial8250_rpm_get(up);
+       /*
+        * The IRQ might be shared with other peripherals so we must first
+        * check that are we RPM suspended or not. If we are we assume that
+        * the IRQ was not for us (we shouldn't be RPM suspended when the
+        * interrupt is enabled).
+        */
+       if (pm_runtime_suspended(port->dev))
+               return 0;
 
        iir = serial_port_in(port, UART_IIR);
-       ret = serial8250_handle_irq(port, iir);
-
-       serial8250_rpm_put(up);
-       return ret;
+       return serial8250_handle_irq(port, iir);
 }
 
 /*
-- 
1.9.1

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to