From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C2A0C35DFB for ; Tue, 25 Feb 2020 09:06:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63C4F2176D for ; Tue, 25 Feb 2020 09:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729863AbgBYJGA (ORCPT ); Tue, 25 Feb 2020 04:06:00 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:48635 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729765AbgBYJGA (ORCPT ); Tue, 25 Feb 2020 04:06:00 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6WA5-0007xl-H8; Tue, 25 Feb 2020 10:05:53 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1j6WA3-0003FW-Gm; Tue, 25 Feb 2020 10:05:51 +0100 Date: Tue, 25 Feb 2020 10:05:51 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Johan Hovold Cc: kernel@pengutronix.de, linux-serial@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Dan Murphy , Pavel Machek , Jiri Slaby , linux-leds@vger.kernel.org, Jacek Anaszewski Subject: Re: [PATCH v6 2/4] tty: rename tty_kopen() and add new function tty_kopen_shared() Message-ID: <20200225090551.jhj7sc75neyphbss@pengutronix.de> References: <20200213091600.554-1-uwe@kleine-koenig.org> <20200213091600.554-3-uwe@kleine-koenig.org> <20200219132113.GD32540@localhost> <20200219163758.5rypsol4n6ucost4@pengutronix.de> <20200219171759.GE32540@localhost> <20200220110427.e6jgzvdhh3ysql3n@pengutronix.de> <20200225085503.GP32540@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200225085503.GP32540@localhost> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-leds@vger.kernel.org Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Tue, Feb 25, 2020 at 09:55:03AM +0100, Johan Hovold wrote: > On Thu, Feb 20, 2020 at 12:04:27PM +0100, Uwe Kleine-König wrote: > > Ah I think I see. tty_driver_lookup_tty() might return NULL which for > > the trigger driver indicates that tty_kopen_shared should be retried, > > right? > > I'm not sure how best to handle this, but yes, your trigger can only be > enabled while the port is open currently. And no error is returned to a > user trying to enable the trigger before it has been opened. > > But regardless of the error reporting, I don't think failing when the > port isn't open is the right thing to do as as this makes the interface > rather useless since you cannot enable a trigger from for example a udev > rule. > > If this approach is to be used at all, it seems you may need to allocate > the struct tty when the trigger is enabled. And make sure you don't mess > up some other assumption in tty core... My idea is instead to retry opening the device later. At least this sounds easier. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |