Re: [patch] staging: speakup: safely close tty

From: Alan Cox
Date: Wed Jul 12 2017 - 14:25:46 EST

> spk_ttyio_initialise_ldisc is called separately for each module (e.g.
> speakup_apollo, speakup_ltlk etc) when it is loaded. spk_ttyio_release
> is also called separately for each module when it is unloaded. The ldisc
> stays around until the last of the modules is unloaded.

What guarantees that someone hasn't decided to set the ldisc on unrelated
hardware to speakup (eg on a pty/tty pair).
> >
> > I'd also btw strongly recommend putting the ldisc and the speakup tty
> > driver as different modules.
> Sure, that makes sense. I will do that following these patches.

If the ldisc is just unregistered when the module implementing it is
unloaded then the ref counts on the ldisc module should do everything
needed if the above isn't correctly handled, and if it is will still be