Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752715AbdFOOoo (ORCPT ); Thu, 15 Jun 2017 10:44:44 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:32928 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbdFOOoE (ORCPT ); Thu, 15 Jun 2017 10:44:04 -0400 MIME-Version: 1.0 In-Reply-To: <20170614143300.5f2ebe4c@alans-desktop> References: <1497336734-19368-1-git-send-email-tal.shorer@gmail.com> <1497336734-19368-2-git-send-email-tal.shorer@gmail.com> <20170614021505.5a915c2b@alans-desktop> <20170614143300.5f2ebe4c@alans-desktop> From: Tal Shorer Date: Thu, 15 Jun 2017 17:44:03 +0300 Message-ID: Subject: Re: [PATCH v2 1/8] tty: add a poll() callback in struct tty_operations To: Alan Cox Cc: linux-doc@vger.kernel.org, "" , USB list , "" , Felipe Balbi , Jonathan Corbet Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1250 Lines: 25 On Wed, Jun 14, 2017 at 4:33 PM, Alan Cox wrote: >> That would cut it, but TIOCPKT is too coupled with having a linked tty. >> I could make acm behave like a pty (accept TIOCPKT and issue the >> ctrl_status bits), but for that I need n_tty to know that packet does >> not always mean a linked tty is present, and that in case it isn't we >> take our own ctrl_status bits instead of the link's. I could write a >> small (inline?) function to fetch the correct ctrl_status bits and put >> that in n_tty. Does that make sense? > > I think that makes sense, and I would do the job properly rather than do > a hack with tty->link. Those hacks in the long term never work out the > best approach. > > Alan Ok, so I'm doing that and everything is great until I got to actually modifying tty->termios. I need to modify it from interrupt context (the usb_request's complete() callback), but modifying the termios requires a rw_semaphore I can't take. I could queue_work() to do it, but then I'd have to flush the work from another non-sleepable context in acm_disconnect() (which runs under a spinlock). I can't change the semaphore to a spinlock because some drivers that use it actually wanna sleep while holding it. Any ideas?