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

tty: Simplify tty_release_checks() interface

Passing the 'other' tty to tty_release_checks() only makes sense
for a pty pair; make o_tty scope local instead.
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 62462aef
...@@ -1702,8 +1702,7 @@ static void release_tty(struct tty_struct *tty, int idx) ...@@ -1702,8 +1702,7 @@ static void release_tty(struct tty_struct *tty, int idx)
* Performs some paranoid checking before true release of the @tty. * Performs some paranoid checking before true release of the @tty.
* This is a no-op unless TTY_PARANOIA_CHECK is defined. * This is a no-op unless TTY_PARANOIA_CHECK is defined.
*/ */
static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty, static int tty_release_checks(struct tty_struct *tty, int idx)
int idx)
{ {
#ifdef TTY_PARANOIA_CHECK #ifdef TTY_PARANOIA_CHECK
if (idx < 0 || idx >= tty->driver->num) { if (idx < 0 || idx >= tty->driver->num) {
...@@ -1722,6 +1721,8 @@ static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty, ...@@ -1722,6 +1721,8 @@ static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty,
return -1; return -1;
} }
if (tty->driver->other) { if (tty->driver->other) {
struct tty_struct *o_tty = tty->link;
if (o_tty != tty->driver->other->ttys[idx]) { if (o_tty != tty->driver->other->ttys[idx]) {
printk(KERN_DEBUG "%s: other->table[%d] not o_tty for (%s)\n", printk(KERN_DEBUG "%s: other->table[%d] not o_tty for (%s)\n",
__func__, idx, tty->name); __func__, idx, tty->name);
...@@ -1777,7 +1778,7 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1777,7 +1778,7 @@ int tty_release(struct inode *inode, struct file *filp)
/* Review: parallel close */ /* Review: parallel close */
o_tty = tty->link; o_tty = tty->link;
if (tty_release_checks(tty, o_tty, idx)) { if (tty_release_checks(tty, idx)) {
tty_unlock(tty); tty_unlock(tty);
return 0; return 0;
} }
......
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