Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp208839rdf; Mon, 20 Nov 2023 23:35:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJBPwdgbchR1yFUJGUUT0YOjykGlT5/RvbWCHC6Este6OPeYqBooE2n4W6vlTQpwr5JEqH X-Received: by 2002:a05:6a20:9f88:b0:18a:e802:f7a1 with SMTP id mm8-20020a056a209f8800b0018ae802f7a1mr1208157pzb.1.1700552146244; Mon, 20 Nov 2023 23:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700552146; cv=none; d=google.com; s=arc-20160816; b=N0cb+oj95gBYxCfWP8KKOiHc6elm8nv+5gPBz0SJCWMAcBbYMcAVOTmuLDRZVjHUM3 XHBZhfqoaVnBdmr5/eddy4Ia5tMNWqhOhIWzWCxfCGc0KZs+hEYuiiuTUysvxxtXvjB1 MGnDCntoccm1MtpUNMKqxUkHeUi6ZwZqN2TXg30yc/iR9E1WTpE3FsrSH6RTdHZO2Bnc /oxP4FbmmHM/VEbkrKxYKQe0QZGFn6J7FhpBP6sDTOG1+hokHBjM3MBYcbItU6qOtv1D RsjVtg866w4o6QP5qB7BavsVl59qlYjZY5VxUPwB9udRUJv3+HMWgq1wXc2T1Am6HYND 6jjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version; bh=MY77kAtt2rnz3sQri1Uv22Z8OydIavr/LN6bORclzxo=; fh=zEbPiaqse39DM9IFlysPEeEAGpDi95v/lVhhCSy+LOo=; b=Egb7OPndw7eOHLVIOzazpg3C38UWFDIE8cZDVkPXlg1ZK5ZSAOrXmjMMBZajTGmSuO zHW1LFcO3ptGEqml7jt4ocir9O4+Jl5WjxToBwK53AROPN0obE884Az63ha3im903tEW H5ojeKJvO26sXJfSEumltG/Fu9Nd/W3o+1i/TSSpViLPkmVmbvpu80vyoglBHMHw2GaC 1A1wzg/jDoC6G41pNcrVyD/wIdSuG+WKI1pwktS+nNvFZq4vrrVRaDtcPFD+fzZ8F8F5 cwZlogYzRLzKG4rxzMX5KoMVHz6GeOFOTMENGyQXgmWP7gVAchpCWamW6dkZXXRMctqZ nieg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id lb2-20020a17090b4a4200b00262e5a82047si10310993pjb.44.2023.11.20.23.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 23:35:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 948AF80A9B18; Mon, 20 Nov 2023 23:35:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbjKUHfd (ORCPT + 99 others); Tue, 21 Nov 2023 02:35:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjKUHfc (ORCPT ); Tue, 21 Nov 2023 02:35:32 -0500 Received: from mxout70.expurgate.net (mxout70.expurgate.net [194.37.255.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DDCDB9; Mon, 20 Nov 2023 23:35:28 -0800 (PST) Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1r5LHu-00EQkE-6R; Tue, 21 Nov 2023 08:35:14 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r5LHt-00GH9Z-4o; Tue, 21 Nov 2023 08:35:13 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id BC857240049; Tue, 21 Nov 2023 08:35:12 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 18521240040; Tue, 21 Nov 2023 08:35:12 +0100 (CET) Received: from mail.dev.tdt.de (localhost [IPv6:::1]) by mail.dev.tdt.de (Postfix) with ESMTP id 9BDCA33A3D; Tue, 21 Nov 2023 08:35:11 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 21 Nov 2023 08:35:11 +0100 From: Florian Eckert To: Jiri Slaby Cc: Eckert.Florian@googlemail.com, gregkh@linuxfoundation.org, pavel@ucw.cz, lee@kernel.org, kabel@kernel.org, u.kleine-koenig@pengutronix.de, m.brock@vanmierlo.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [Patch v8 1/6] tty: add new helper function tty_get_tiocm In-Reply-To: <1b89d7df-2511-4b3e-ab35-071734fb413c@kernel.org> References: <20231109085038.371977-1-fe@dev.tdt.de> <20231109085038.371977-2-fe@dev.tdt.de> <1b89d7df-2511-4b3e-ab35-071734fb413c@kernel.org> Message-ID: X-Sender: fe@dev.tdt.de User-Agent: Roundcube Webmail/1.3.17 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-purgate-ID: 151534::1700552113-D1E98639-88650825/0/0 X-purgate: clean X-purgate-type: clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 23:35:43 -0800 (PST) On 2023-11-20 08:21, Jiri Slaby wrote: > On 09. 11. 23, 9:50, Florian Eckert wrote: >> There is no in-kernel function to get the status register of a tty >> device >> like the TIOCMGET ioctl returns to userspace. Create a new function, >> tty_get_tiocm(), to obtain the status register that other portions of >> the >> kernel can call if they need this information, and move the existing >> internal tty_tiocmget() function to use this interface. >> >> Acked-by: Greg Kroah-Hartman >> Signed-off-by: Florian Eckert >> --- >> drivers/tty/tty_io.c | 28 ++++++++++++++++++++++------ >> include/linux/tty.h | 1 + >> 2 files changed, 23 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c >> index 06414e43e0b5..e2e93404133e 100644 >> --- a/drivers/tty/tty_io.c >> +++ b/drivers/tty/tty_io.c >> @@ -2498,6 +2498,24 @@ static int send_break(struct tty_struct *tty, >> unsigned int duration) >> return retval; >> } >> +/** >> + * tty_get_tiocm - get tiocm status register >> + * @tty: tty device >> + * >> + * Obtain the modem status bits from the tty driver if the feature >> + * is supported. >> + */ >> +int tty_get_tiocm(struct tty_struct *tty) >> +{ >> + int retval = -ENOTTY; >> + >> + if (tty->ops->tiocmget) >> + retval = tty->ops->tiocmget(tty); >> + >> + return retval; > > Why not simply: I just did it this way because it is also done this way in other functions in this file. > { > if (tty->ops->tiocmget) > return tty->ops->tiocmget(tty); > > return -ENOTTY; > } Of course, we could also do it this way. If this is the C style for the kernel, then I will change it. Please give me a short feedback whether I should change it and send a v9, or whether it is just a comment from you. Best regards Florian