Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751396AbdGMLYu (ORCPT ); Thu, 13 Jul 2017 07:24:50 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35129 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbdGMLYt (ORCPT ); Thu, 13 Jul 2017 07:24:49 -0400 Date: Thu, 13 Jul 2017 12:24:45 +0100 From: Okash Khawaja To: Alan Cox Cc: Greg Kroah-Hartman , Samuel Thibault , linux-kernel@vger.kernel.org, William Hubbs , Chris Brannon , Kirk Reiser , speakup@linux-speakup.org, devel@driverdev.osuosl.org Subject: Re: [patch] staging: speakup: safely close tty Message-ID: <20170713112445.GA2696@sanghar> References: <20170707191301.GA3798@sanghar> <20170710125544.2aa4d12a@alans-desktop> <20170711103913.GA561@sanghar> <20170712192522.34f65e3b@alans-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170712192522.34f65e3b@alans-desktop> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 964 Lines: 20 On Wed, Jul 12, 2017 at 07:25:22PM +0100, Alan Cox wrote: > > 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 > cleaner. Right, I understand now. Thanks. I will update and resend this patch.