Re: [PATCH 4/6] drivers:misc: sources for Init manager module
From: Alan Cox
Date: Wed Mar 24 2010 - 13:16:54 EST
> Alan's talking about opening up the LDISC installation to kernel (say EXPORTING tty_set_ldisc/tiocsetd), That's like ideal scenario in this case.
Ok I lied - its four lines of code changing, and just set
.ldisc = N_whatever
in your tty_driver
Marcel - that should also clean up some of the other pending goodies
[Untested Patch]
--
tty: Allow the driver to force an ldisc on open
From: Alan Cox <alan@xxxxxxxxxxxxxxx>
We need this because some hardware is always in various mux or control
modes. At the moment we do handstands via userspace to sort this out on
devices where it makes no sense. Given the size of the patch to fix this
inanity we might as well do so.
Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
---
drivers/char/tty_ldisc.c | 6 +++---
include/linux/tty_driver.h | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 500e740..b149f9c 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -863,8 +863,8 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
/* Force an oops if we mess this up */
tty->ldisc = NULL;
- /* Ensure the next open requests the N_TTY ldisc */
- tty_set_termios_ldisc(tty, N_TTY);
+ /* Ensure the next open requests the expected (usually N_TTY) ldisc */
+ tty_set_termios_ldisc(tty, tty->driver->ldisc);
mutex_unlock(&tty->ldisc_mutex);
/* This will need doing differently if we need to lock */
@@ -885,7 +885,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
void tty_ldisc_init(struct tty_struct *tty)
{
- struct tty_ldisc *ld = tty_ldisc_get(N_TTY);
+ struct tty_ldisc *ld = tty_ldisc_get(tty->driver->ldisc);
if (IS_ERR(ld))
panic("n_tty: init_tty");
tty_ldisc_assign(tty, ld);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b086779..fc22a41 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -291,6 +291,7 @@ struct tty_driver {
short type; /* type of tty driver */
short subtype; /* subtype of tty driver */
struct ktermios init_termios; /* Initial termios */
+ int ldisc; /* initial ldisc */
int flags; /* tty driver flags */
struct proc_dir_entry *proc_entry; /* /proc fs entry */
struct tty_driver *other; /* only used for the PTY driver */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/