Simplify TTY sending code and locking
authornorly <ny-git@enpas.org>
Tue, 26 Apr 2022 22:22:03 +0000 (00:22 +0200)
committernorly <ny-git@enpas.org>
Thu, 28 Apr 2022 00:23:33 +0000 (02:23 +0200)
commit3e68b297c23584d52a0d51b63516018cb90faf55
tree83db7df9d8e3634ae185b1acdf6e4a1174d11214
parent7553f57af5a80c80dcb7957d1347a06dcc580805
Simplify TTY sending code and locking

The great get_elm() dance was unnecessary, since the TTY layer already
synchronises *all* calls to ldisc_ops with tty_ldisc_ref() and
tty_ldisc_lock().

All that we have to ensure is that the worker does not race against
close(), which is trivial if we clear TTY_DO_WRITE_WAKEUP and then flush
the worker.

Also, the worker no longer checks whether the netdev is up - all it
needs to do is to write out the TTY buffer, and wake up the netdev when
the buffer is empty.
module/elmcan.c