void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) { /* * Prevent flush_to_ldisc() from rescheduling the work for later. Then * kill any delayed work. As this is the final close it does not * race with the set_ldisc code path. */ tty_lock_pair(tty, o_tty); tty_ldisc_halt(tty); tty_ldisc_flush_works(tty); if (o_tty) { tty_ldisc_halt(o_tty); tty_ldisc_flush_works(o_tty); } /* This will need doing differently if we need to lock */ tty_ldisc_kill(tty); if (o_tty) tty_ldisc_kill(o_tty); tty_unlock_pair(tty, o_tty); /* And the memory resources remaining (buffers, termios) will be disposed of when the kref hits zero */ }
void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) { /* * Shutdown this line discipline. As this is the final close, * it does not race with the set_ldisc code path. */ tty_ldisc_debug(tty, "closing ldisc: %p\n", tty->ldisc); tty_ldisc_lock_pair(tty, o_tty); tty_lock_pair(tty, o_tty); tty_ldisc_kill(tty); if (o_tty) tty_ldisc_kill(o_tty); tty_unlock_pair(tty, o_tty); tty_ldisc_unlock_pair(tty, o_tty); /* And the memory resources remaining (buffers, termios) will be disposed of when the kref hits zero */ tty_ldisc_debug(tty, "ldisc closed\n"); }