public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: "Govindraj.R" <govindraj.raja@ti.com>
To: linux-serial@vger.kernel.org
Cc: Paul Walmsley <paul@pwsan.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	Greg KH <greg@kroah.com>
Subject: [PATCH] Serial: Avoid unbalanced IRQ wake disable during resume
Date: Thu, 16 Dec 2010 18:12:47 +0530 (IST)	[thread overview]
Message-ID: <14261.10.24.255.17.1292503367.squirrel@dbdmail.itg.ti.com> (raw)

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>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Greg KH <greg@kroah.com>
---
This patch is in conclusion to issue discussed in below thread:
http://www.spinics.net/lists/linux-omap/msg41356.html

 drivers/serial/serial_core.c |    8 ++++++--
 include/linux/serial_core.h  |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 9ffa5be..7ec1e11 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1985,7 +1985,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;
@@ -2051,7 +2052,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;
 	}
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 212eb4c..28b6698 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -361,6 +361,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 */
 };
-- 
1.7.1



             reply	other threads:[~2010-12-16 12:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 12:42 Govindraj.R [this message]
2010-12-16 19:01 ` [PATCH] Serial: Avoid unbalanced IRQ wake disable during resume Kevin Hilman
2010-12-17  6:22 ` Santosh Shilimkar
2010-12-17  7:04   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14261.10.24.255.17.1292503367.squirrel@dbdmail.itg.ti.com \
    --to=govindraj.raja@ti.com \
    --cc=greg@kroah.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=santosh.shilimkar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox