mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Pavel Machek <pavel@ucw.cz>, Dave Jones <davej@redhat.com>,
	Sanjoy Mahajan <sanjoy@mrao.cam.ac.uk>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Paul Dickson <paul@permanentmail.com>,
	linux-kernel@vger.kernel.org, jeremy@goop.org
Subject: Re: Bisects that are neither good nor bad
Date: Sun, 11 Jun 2006 15:08:37 +0100	[thread overview]
Message-ID: <20060611140836.GB25561@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060609084234.GA25497@flint.arm.linux.org.uk>

On Fri, Jun 09, 2006 at 09:42:34AM +0100, Russell King wrote:
> The only sane solution is for the tty layer to be adjusted to allow
> suspend/resume support for consoles.

And for those who can't work out how to do that, here's something which
_probably_ does it.  Would folk mind testing it out please?

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1674,6 +1674,19 @@ release_mem_out:
 }
 
 /*
+ * Get a copy of the termios structure for the driver/index
+ */
+void tty_get_termios(struct tty_driver *driver, int idx, struct termios *tio)
+{
+	lock_kernel();
+	if (driver->termios[idx])
+		*tio = *driver->termios[idx];
+	else
+		*tio = driver->init_termios;
+	unlock_kernel();
+}
+
+/*
  * Releases memory associated with a tty structure, and clears out the
  * driver table slots.
  */
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1968,16 +1968,16 @@ int uart_resume_port(struct uart_driver 
 		struct termios termios;
 
 		/*
-		 * First try to use the console cflag setting.
+		 * Get the termios for this line
 		 */
-		memset(&termios, 0, sizeof(struct termios));
-		termios.c_cflag = port->cons->cflag;
+		tty_get_termios(drv->tty_driver, port->line, &termios);
 
 		/*
-		 * If that's unset, use the tty termios setting.
+		 * If the console cflag is still set, subsitute that
+		 * for the termios cflag.
 		 */
-		if (state->info && state->info->tty && termios.c_cflag == 0)
-			termios = *state->info->tty->termios;
+		if (port->cons->cflag)
+			termios.c_cflag = port->cons->cflag;
 
 		port->ops->set_termios(port, &termios, NULL);
 		console_start(port->cons);
diff --git a/include/linux/tty.h b/include/linux/tty.h
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -297,6 +297,8 @@ extern int tty_read_raw_data(struct tty_
 			     int buflen);
 extern void tty_write_message(struct tty_struct *tty, char *msg);
 
+extern void tty_get_termios(struct tty_driver *drv, int idx, struct termios *tio);
+
 extern int is_orphaned_pgrp(int pgrp);
 extern int is_ignored(int sig);
 extern int tty_signal(int sig, struct tty_struct *tty);


-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

  parent reply	other threads:[~2006-06-11 14:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-28 21:02 Resume stops working between 2.6.16 and 2.6.17-rc1 on Dell Inspiron 6000 Paul Dickson
2006-05-28 21:08 ` Bisects that are neither good nor bad Paul Dickson
2006-05-28 21:24   ` Rafael J. Wysocki
2006-05-28 21:34     ` Dave Jones
2006-05-29 11:37       ` Sanjoy Mahajan
2006-05-29 14:52         ` Dave Jones
2006-05-30 15:29           ` Pavel Machek
2006-06-03  8:58             ` Rafael J. Wysocki
2006-06-03  9:11             ` Russell King
2006-06-09  8:38               ` Pavel Machek
2006-06-09  8:42                 ` Russell King
2006-06-09  8:46                   ` fixing serial console over suspend [was Re: Bisects that are neither good nor bad] Pavel Machek
2006-06-09  8:51                     ` Russell King
2006-06-11 14:08                   ` Russell King [this message]
2006-05-31  2:45           ` Bisects that are neither good nor bad Paul Dickson
2006-05-28 22:02     ` Paul Dickson
2006-05-29  0:12       ` Paul Dickson
2006-05-28 21:11 ` Resume stops working between 2.6.16 and 2.6.17-rc1 on Dell Inspiron 6000 Arjan van de Ven
2006-05-28 21:29   ` Paul Dickson
2006-05-28 21:49     ` Mark Lord
2006-05-29  0:21       ` Paul Dickson
2006-05-29  0:40         ` Andrew Morton
2006-05-29  1:47           ` Paul Dickson
2006-05-29  3:02         ` Mark Lord
2006-05-29 15:12           ` Pavel Machek
2006-05-31  2:38             ` Paul Dickson
2006-05-29  3:03         ` Mark Lord
2006-05-29 22:56 Bisects that are neither good nor bad linux
2006-05-30  0:46 ` Linus Torvalds

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=20060611140836.GB25561@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=davej@redhat.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@permanentmail.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=sanjoy@mrao.cam.ac.uk \
    /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

Powered by JetHome