struct tty_ldisc * tty_ldisc_ref_wait (struct tty_struct * tty);
Dereference the line discipline for the terminal and take a reference to it. If the line discipline is in flux then wait patiently until it changes.
Must not be called from an IRQ/timer context. The caller must also be careful not to hold other locks that will deadlock against a discipline change, such as an existing ldisc reference (which we check for)