summaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-11-05 10:09:12 -0800
committerOlof Johansson <olof@lixom.net>2012-11-05 10:09:12 -0800
commit6d06721570aa0c38d886e3036796d59983963a27 (patch)
treed674cf54e26837bee89095c211ffa362c8546f03 /drivers/tty/tty_io.c
parent148a8698763130c96004ef419b5f0d44a93d413c (diff)
parent54ec52b6dd3b0ba4bc4eb97e7e1b2534705b326c (diff)
downloadlinux-6d06721570aa0c38d886e3036796d59983963a27.tar.bz2
Merge branch 'depends/tty' into next/headers
Merging in Greg's tty tree including a cleanup patch needed by the OMAP serial header cleanups. * depends/tty: (305 commits) tty/serial/8250: Make omap hardware workarounds local to 8250.h serial/8250/8250_early: Prevent rounding error in uartclk serial: samsung: use clk_prepare_enable and clk_disable_unprepare TTY: Report warning when low_latency flag is wrongly used console: use might_sleep in console_lock TTY: move tty buffers to tty_port TTY: add port -> tty link TTY: tty_buffer, cache pointer to tty->buf TTY: move TTY_FLUSH* flags to tty_port TTY: n_tty, propagate n_tty_data TTY: move ldisc data from tty_struct: locks TTY: move ldisc data from tty_struct: read_* and echo_* and canon_* stuff TTY: move ldisc data from tty_struct: bitmaps TTY: move ldisc data from tty_struct: simple members TTY: n_tty, add ldisc data to n_tty TTY: audit, stop accessing tty->icount TTY: n_tty, remove bogus checks TTY: n_tty, simplify read_buf+echo_buf allocation TTY: hci_ldisc, remove invalid check in open TTY: ldisc, wait for idle ldisc in release ...
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r--drivers/tty/tty_io.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 2ea176b2280e..a3eba7f359ed 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -186,7 +186,6 @@ void free_tty_struct(struct tty_struct *tty)
if (tty->dev)
put_device(tty->dev);
kfree(tty->write_buf);
- tty_buffer_free_all(tty);
tty->magic = 0xDEADDEAD;
kfree(tty);
}
@@ -1417,6 +1416,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
"%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n",
__func__, tty->driver->name);
+ tty->port->itty = tty;
+
/*
* Structures all installed ... call the ldisc open routines.
* If we fail here just call release_tty to clean up. No need
@@ -1552,6 +1553,7 @@ static void release_tty(struct tty_struct *tty, int idx)
tty->ops->shutdown(tty);
tty_free_termios(tty);
tty_driver_remove_tty(tty->driver, tty);
+ tty->port->itty = NULL;
if (tty->link)
tty_kref_put(tty->link);
@@ -1625,7 +1627,6 @@ int tty_release(struct inode *inode, struct file *filp)
struct tty_struct *tty = file_tty(filp);
struct tty_struct *o_tty;
int pty_master, tty_closing, o_tty_closing, do_sleep;
- int devpts;
int idx;
char buf[64];
@@ -1640,7 +1641,6 @@ int tty_release(struct inode *inode, struct file *filp)
idx = tty->index;
pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER);
- devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0;
/* Review: parallel close */
o_tty = tty->link;
@@ -1799,9 +1799,6 @@ int tty_release(struct inode *inode, struct file *filp)
release_tty(tty, idx);
mutex_unlock(&tty_mutex);
- /* Make this pty number available for reallocation */
- if (devpts)
- devpts_kill_index(inode, idx);
return 0;
}
@@ -2937,19 +2934,13 @@ void initialize_tty_struct(struct tty_struct *tty,
tty_ldisc_init(tty);
tty->session = NULL;
tty->pgrp = NULL;
- tty->overrun_time = jiffies;
- tty_buffer_init(tty);
mutex_init(&tty->legacy_mutex);
mutex_init(&tty->termios_mutex);
mutex_init(&tty->ldisc_mutex);
init_waitqueue_head(&tty->write_wait);
init_waitqueue_head(&tty->read_wait);
INIT_WORK(&tty->hangup_work, do_tty_hangup);
- mutex_init(&tty->atomic_read_lock);
mutex_init(&tty->atomic_write_lock);
- mutex_init(&tty->output_lock);
- mutex_init(&tty->echo_lock);
- spin_lock_init(&tty->read_lock);
spin_lock_init(&tty->ctrl_lock);
INIT_LIST_HEAD(&tty->tty_files);
INIT_WORK(&tty->SAK_work, do_SAK_work);