From: Deepak Saxena <dsaxena@plexity.net>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 8250: Don't restore NS16550 mode when console suspend is disabled
Date: Wed, 13 May 2009 18:04:36 +0000 [thread overview]
Message-ID: <20090513180436.GA5592@plexity.net> (raw)
In-Reply-To: <20090513163507.556c3832@lxorguk.ukuu.org.uk>
[-- Attachment #1: Type: text/plain, Size: 950 bytes --]
On May 13 2009, at 16:35, Alan Cox was caught saying:
> Deepak's original patch from 2008 is actually much better. He puts the
> chip back in the right hardware configuration for the speed. He doesn't
> randomly regress other platforms and configurations and he does it by
> calling the standard methods in the driver to do the job.
>
> http://dev.laptop.org/~dsaxena/patches/console_suspend_old.patch
>
> It also has another advantage - it fixes the behaviour for almost
> everything in drivers/serial not just a specific uart. Technically he
> should take tty->termios_mutex before state->mutex in that code path as
> the upstream code has changed but in every other respect its the proper
> solution.
I thought the fact that we were touching a core driver to fix what
seemed like an XO issue was too intrusive.
> So can we apply Deepak's original correct 2008 patch instead please ?
I've updated it with proper header and attached.
~Deepak
[-- Attachment #2: restore_console_settings_on_suspend.patch --]
[-- Type: text/x-diff, Size: 2149 bytes --]
Set proper console speed on resume if console suspend is disabled
Commit b5b82df6, from May 2007, breaks no_console_suspend on the OLPC
XO laptop. Basically what happens is that upon returning from resume,
serial8250_resume_port() will reconfigure the port for high speed
mode and all console output will be garbled, making debug of the
resume path painful. This patch modifies uart_resume_port() to
reset the port to the state it was in before we suspended.
Original patch by Marcelo Tosatti
Signed-off-by: Deepak Saxena <dsaxena@laptop.org>
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index b0bb29d..3b71038 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2052,11 +2052,26 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
struct uart_state *state = drv->state + port->line;
struct device *tty_dev;
struct uart_match match = {port, drv};
+ struct ktermios termios;
mutex_lock(&state->mutex);
+ /*
+ * First try to use the console cflag setting.
+ */
+ memset(&termios, 0, sizeof(struct ktermios));
+ termios.c_cflag = port->cons->cflag;
+
+ /*
+ * If that's unset, use the tty termios setting.
+ */
+ if (termios.c_cflag == 0)
+ termios = *state->info.port.tty->termios;
+
+
if (!console_suspend_enabled && uart_console(port)) {
/* no need to resume serial console, it wasn't suspended */
+ port->ops->set_termios(port, &termios, NULL);
mutex_unlock(&state->mutex);
return 0;
}
@@ -2073,20 +2088,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
* Re-enable the console device after suspending.
*/
if (uart_console(port)) {
- struct ktermios termios;
-
- /*
- * First try to use the console cflag setting.
- */
- memset(&termios, 0, sizeof(struct ktermios));
- termios.c_cflag = port->cons->cflag;
-
- /*
- * If that's unset, use the tty termios setting.
- */
- if (state->info.port.tty && termios.c_cflag == 0)
- termios = *state->info.port.tty->termios;
-
uart_change_pm(state, 0);
port->ops->set_termios(port, &termios, NULL);
console_start(port->cons);
next prev parent reply other threads:[~2009-05-13 18:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-12 21:00 [PATCH] 8250: Don't restore NS16550 mode when console suspend is disabled Deepak Saxena
2009-05-12 22:00 ` Linus Torvalds
2009-05-13 0:18 ` Alan Cox
2009-05-13 0:28 ` Deepak Saxena
2009-05-13 8:44 ` Alan Cox
2009-05-13 14:58 ` Linus Torvalds
2009-05-13 15:35 ` Alan Cox
2009-05-13 18:04 ` Deepak Saxena [this message]
2009-05-13 18:46 ` Alan Cox
2009-05-18 18:24 ` Deepak Saxena
2009-05-18 19:07 ` Alan Cox
2009-05-13 1:01 ` Joe Perches
2009-05-13 0:34 ` Deepak Saxena
2009-05-12 22:08 ` Michał Mirosław
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=20090513180436.GA5592@plexity.net \
--to=dsaxena@plexity.net \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=torvalds@linux-foundation.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