linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Courbot <gnurou@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] serial: sh-sci: fix deadlock when resuming from S3 sleep
Date: Thu, 03 Mar 2011 08:04:42 +0000	[thread overview]
Message-ID: <1299139482-5235-1-git-send-email-gnurou@gmail.com> (raw)

S3 sleep invokes the shutdown callback of the sh-sci driver, which
suspends the clocks until they are reactivated by a call to startup.
However, before the latter is invoked, sci_set_termios may be called on
the port by uart_resume_port. In such cases it will endlessly wait for
the TEND bit to raise, which will never happen since the clocks are
disabled.

This patch ensures that clocks are enabled when ports registers are
manipulated within sci_set_termios.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
---
 drivers/tty/serial/sh-sci.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index e180bc9..264209c 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1504,6 +1504,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 	if (likely(baud && port->uartclk))
 		t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk);
 
+	if (s->enable)
+		s->enable(port);
+
 	do {
 		status = sci_in(port, SCxSR);
 	} while (!(status & SCxSR_TEND(port)));
@@ -1571,6 +1574,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	if ((termios->c_cflag & CREAD) != 0)
 		sci_start_rx(port);
+
+	if (s->disable)
+		s->disable(port);
 }
 
 static const char *sci_type(struct uart_port *port)
-- 
1.7.4.1


             reply	other threads:[~2011-03-03  8:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  8:04 Alexandre Courbot [this message]
2011-03-04  6:57 ` [PATCH] serial: sh-sci: fix deadlock when resuming from S3 sleep Paul Mundt

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=1299139482-5235-1-git-send-email-gnurou@gmail.com \
    --to=gnurou@gmail.com \
    --cc=linux-sh@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;
as well as URLs for NNTP newsgroup(s).