lkml.org 
[lkml]   [2006]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Bisects that are neither good nor bad
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-11 16:11    [W:0.055 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site