Skip to content

Commit

Permalink
tty: Move tty_ldisc_kill()
Browse files Browse the repository at this point in the history
In preparation for destroying the line discipline instance on hangup,
move tty_ldisc_kill() to eliminate needless forward declarations.
No functional change.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Jan 27, 2016
1 parent a570a49 commit 6ffeb4b
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions drivers/tty/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,25 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
return retval;
}

/**
* tty_ldisc_kill - teardown ldisc
* @tty: tty being released
*
* Perform final close of the ldisc and reset tty->ldisc
*/
static void tty_ldisc_kill(struct tty_struct *tty)
{
if (!tty->ldisc)
return;
/*
* Now kill off the ldisc
*/
tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc);
/* Force an oops if we mess this up */
tty->ldisc = NULL;
}

/**
* tty_reset_termios - reset terminal state
* @tty: tty to reset
Expand Down Expand Up @@ -747,19 +766,6 @@ int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty)
return 0;
}

static void tty_ldisc_kill(struct tty_struct *tty)
{
if (!tty->ldisc)
return;
/*
* Now kill off the ldisc
*/
tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc);
/* Force an oops if we mess this up */
tty->ldisc = NULL;
}

/**
* tty_ldisc_release - release line discipline
* @tty: tty being shut down (or one end of pty pair)
Expand Down

0 comments on commit 6ffeb4b

Please sign in to comment.