[patch 1/6] tty_port: allow a port to be opened with a tty that has no file handle

Samuel Thibault samuel.thibault at ens-lyon.org
Sat Feb 25 19:53:42 EST 2017


Okash Khawaja, on sam. 25 févr. 2017 19:21:32 +0000, wrote:
> Allow access to TTY device from kernel.

When opening the TTY from an application (e.g. echo foo > /dev/ttyS0),
we get this:

ttyS ttyS0: tty_open: tty->count(3) != #fd's(2)
ttyS ttyS0: tty_release: tty->count(3) != #fd's(2)

This is because the number of files in tty_files doesn't match the
open count for tty. spk_ttyio_initialise_ldisc should thus mimic
tty_open a bit more: after calling tty_open_by_driver, it should call
tty_add_file(tty, NULL); to add an entry in the tty_files list (and why
not calling check_tty_count too).  And of course, the converse
(tty_del_file) should be called by spk_ttyio_release between the
tty_ldisc_flush call and tty_unlock.

The consequence of this is that users of the tty_files list need to be
careful: __tty_hangup must now continue when filp is NULL. That last
modification should be added to patch 1.

Samuel


More information about the Speakup mailing list