public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-serial@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Subject: [PATCH] 8250: when waking, PM hook should be called before accessing port
Date: Wed, 26 Nov 2008 16:25:23 -0800	[thread overview]
Message-ID: <1227745523-5408-2-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1227745523-5408-1-git-send-email-khilman@deeprootsystems.com>

The UART suspend hook may have disabled the UART clocks such that
accesses to the port may fail.  So before accessing the port
call the PM hook so it has a chance to enable clocks.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 drivers/serial/8250.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 993a242..a181667 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2334,10 +2334,18 @@ serial8250_pm(struct uart_port *port, unsigned int state,
 	      unsigned int oldstate)
 {
 	struct uart_8250_port *p = (struct uart_8250_port *)port;
+	int sleep = state != 0;
 
-	serial8250_set_sleep(p, state != 0);
+	/* If we're waking up, call the PM hook before waking up
+	 * so port can be properly activated/enabled if necessary */
+	if (p->pm && !sleep)
+		p->pm(port, state, oldstate);
+
+	serial8250_set_sleep(p, sleep);
 
-	if (p->pm)
+	/* If we're going to sleep, PM hook should be called after
+	 * to deactivate/disable port */
+	if (p->pm && sleep)
 		p->pm(port, state, oldstate);
 }
 
-- 
1.6.0.3


      reply	other threads:[~2008-11-27  0:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27  0:25 [PATCH] 8250: Allow platform to register PM hook Kevin Hilman
2008-11-27  0:25 ` Kevin Hilman [this message]

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=1227745523-5408-2-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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