Commit 04980706 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

tty: Remove TTY_CLOSING

Now that re-open is not permitted for a legacy BSD pty master,
using TTY_CLOSING to indicate when a tty can be torn-down is
no longer necessary.
Reviewed-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aa3cb814
...@@ -1197,7 +1197,7 @@ void tty_write_message(struct tty_struct *tty, char *msg) ...@@ -1197,7 +1197,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)
if (tty) { if (tty) {
mutex_lock(&tty->atomic_write_lock); mutex_lock(&tty->atomic_write_lock);
tty_lock(tty); tty_lock(tty);
if (tty->ops->write && !test_bit(TTY_CLOSING, &tty->flags)) { if (tty->ops->write && tty->count > 0) {
tty_unlock(tty); tty_unlock(tty);
tty->ops->write(tty, msg, strlen(msg)); tty->ops->write(tty, msg, strlen(msg));
} else } else
...@@ -1879,16 +1879,6 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1879,16 +1879,6 @@ int tty_release(struct inode *inode, struct file *filp)
/* /*
* Perform some housekeeping before deciding whether to return. * Perform some housekeeping before deciding whether to return.
* *
* Set the TTY_CLOSING flag if this was the last open. In the
* case of a pty we may have to wait around for the other side
* to close, and TTY_CLOSING makes sure we can't be reopened.
*/
if (tty_closing)
set_bit(TTY_CLOSING, &tty->flags);
if (o_tty_closing)
set_bit(TTY_CLOSING, &o_tty->flags);
/*
* If _either_ side is closing, make sure there aren't any * If _either_ side is closing, make sure there aren't any
* processes that still think tty or o_tty is their controlling * processes that still think tty or o_tty is their controlling
* tty. * tty.
...@@ -1903,7 +1893,7 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1903,7 +1893,7 @@ int tty_release(struct inode *inode, struct file *filp)
mutex_unlock(&tty_mutex); mutex_unlock(&tty_mutex);
tty_unlock_pair(tty, o_tty); tty_unlock_pair(tty, o_tty);
/* At this point the TTY_CLOSING flag should ensure a dead tty /* At this point, the tty->count == 0 should ensure a dead tty
cannot be re-opened by a racing opener */ cannot be re-opened by a racing opener */
/* check whether both sides are closing ... */ /* check whether both sides are closing ... */
......
...@@ -316,7 +316,6 @@ struct tty_file_private { ...@@ -316,7 +316,6 @@ struct tty_file_private {
#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ #define TTY_EXCLUSIVE 3 /* Exclusive open mode */
#define TTY_DEBUG 4 /* Debugging */ #define TTY_DEBUG 4 /* Debugging */
#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ #define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
#define TTY_CLOSING 7 /* ->close() in progress */
#define TTY_LDISC_OPEN 11 /* Line discipline is open */ #define TTY_LDISC_OPEN 11 /* Line discipline is open */
#define TTY_PTY_LOCK 16 /* pty private */ #define TTY_PTY_LOCK 16 /* pty private */
#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment