[PATCH] 8250: when waking, PM hook should be called before accessing port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux