Serial: Avoid unbalanced IRQ wake disable during resume
authorGovindraj.R <govindraj.raja@ti.com>
Thu, 16 Dec 2010 12:42:47 +0000 (18:12 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 16 Dec 2010 21:14:32 +0000 (13:14 -0800)
To avoid unbalanced IRQ wake disable, ensure that wakeups are disabled
only when wakeups have been successfully enabled.
Tested on OMAP3630SDP/ZOOM3.

Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Reported-by: Paul Walmsley <paul@pwsan.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/serial/serial_core.c
include/linux/serial_core.h

index 2835e29298ede2d2fbcc34aed0de17b7da776d2c..76418c139ffafdedaa64b91181deda7692839f08 100644 (file)
@@ -1986,7 +1986,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
 
        tty_dev = device_find_child(uport->dev, &match, serial_match_port);
        if (device_may_wakeup(tty_dev)) {
-               enable_irq_wake(uport->irq);
+               if (!enable_irq_wake(uport->irq))
+                       uport->irq_wake = 1;
                put_device(tty_dev);
                mutex_unlock(&port->mutex);
                return 0;
@@ -2052,7 +2053,10 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 
        tty_dev = device_find_child(uport->dev, &match, serial_match_port);
        if (!uport->suspended && device_may_wakeup(tty_dev)) {
-               disable_irq_wake(uport->irq);
+               if (uport->irq_wake) {
+                       disable_irq_wake(uport->irq);
+                       uport->irq_wake = 0;
+               }
                mutex_unlock(&port->mutex);
                return 0;
        }
index 7a6daf1899956ad99c09ebf0fb4a06eecf67c8f7..a23fa29d4eb0952d7f07d75a14046be21d34cced 100644 (file)
@@ -365,6 +365,7 @@ struct uart_port {
        struct device           *dev;                   /* parent device */
        unsigned char           hub6;                   /* this should be in the 8250 driver */
        unsigned char           suspended;
+       unsigned char           irq_wake;
        unsigned char           unused[2];
        void                    *private_data;          /* generic platform data pointer */
 };