From patchwork Wed Apr 7 09:52:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 417143 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 3949CC43461 for ; Wed, 7 Apr 2021 09:52:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7BF6613A0 for ; Wed, 7 Apr 2021 09:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350335AbhDGJwl (ORCPT ); Wed, 7 Apr 2021 05:52:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:36630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350319AbhDGJwh (ORCPT ); Wed, 7 Apr 2021 05:52:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A86D4610F9; Wed, 7 Apr 2021 09:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617789147; bh=dhB3YFRGCnQZZsZ+E5N95bf1LTkpUAsAw9RDkY2EEo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYRgajsEvz0DP6HnsPm4ern3ZNY4RO8P+edgeDM9njQ+hbRA9YDQz/Tpuj/k9Fb/V IngmXtyzgCEpoLOpGpn+HSdyl1Ram87m+J0p1M1SHfklXjZlDSeC2SUnlp4xFSsnL9 V29tXd82kKtxGiXQ7KT4XfWKq5Egcs8abWC4KAz38rU8bmjH9PnF0FgW6ZA11rkf+d MoOu3mFXRe3FE0RvDZHm4v2iS7uI/jZCRKoFKeUZ0gAfsbFFlWJGOZLcrXxIzSfUiO OJsw6Ki+NzOt7J5ViXy+7KREslACcOYuOBPPGU8sJmeY1TwcfCo2H23clZp6G9FH4a ss/nRrVWwOrlw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lU4rD-0008IP-QJ; Wed, 07 Apr 2021 11:52:19 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/8] tty: actually undefine superseded ASYNC flags Date: Wed, 7 Apr 2021 11:52:01 +0200 Message-Id: <20210407095208.31838-2-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210407095208.31838-1-johan@kernel.org> References: <20210407095208.31838-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Some kernel-internal ASYNC flags have been superseded by tty-port flags and should no longer be used by kernel drivers. Fix the misspelled "__KERNEL__" compile guards which failed their sole purpose to break out-of-tree drivers that have not yet been updated. Fixes: 5c0517fefc92 ("tty: core: Undefine ASYNC_* flags superceded by TTY_PORT* flags") Signed-off-by: Johan Hovold --- include/uapi/linux/tty_flags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/tty_flags.h b/include/uapi/linux/tty_flags.h index 900a32e63424..6a3ac496a56c 100644 --- a/include/uapi/linux/tty_flags.h +++ b/include/uapi/linux/tty_flags.h @@ -39,7 +39,7 @@ * WARNING: These flags are no longer used and have been superceded by the * TTY_PORT_ flags in the iflags field (and not userspace-visible) */ -#ifndef _KERNEL_ +#ifndef __KERNEL__ #define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ #define ASYNCB_SUSPENDED 30 /* Serial port is suspended */ #define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ @@ -81,7 +81,7 @@ #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) -#ifndef _KERNEL_ +#ifndef __KERNEL__ /* These flags are no longer used (and were always masked from userspace) */ #define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED) #define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE) From patchwork Wed Apr 7 09:52:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 417140 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 D001FC43461 for ; Wed, 7 Apr 2021 09:52:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 982B8610F9 for ; Wed, 7 Apr 2021 09:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238413AbhDGJwu (ORCPT ); Wed, 7 Apr 2021 05:52:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:36700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350328AbhDGJwi (ORCPT ); Wed, 7 Apr 2021 05:52:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B52B3613C0; Wed, 7 Apr 2021 09:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617789147; bh=htsE9psDyAopAgk5SadKKKzdBmf+5z0IORwtCSmi050=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IgRr9j+7Bgmvl7RE1qnbySifGNasUNWN8Tmb8qO6US/t/mcaf1Eh4toiH39Phj/nz +qJHt99g6+79o0XB9YFk5qhDZ4GqGWNZxSquCULbBf7SZuB74IjUA33BWJU+TXrz7O ++lE54w9f58+rsHUTgGKfD0bdg6+5Nkb+oS+k7GvKj5IfBFikoE2ttnMDPdz+OUkut VaJd/b75lDM3dfppgsCwGE0/fkWpOyoXqbpRZik/g1G94tBLQFTKRAHdjmhN40WoNe XaR6AUZMM30ywWVf8WzKremzdyGhDQsBATTfFDRQXyNHxECzeG/BC13l+mkEgZT2xf 48bQRKgynwXVA== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lU4rD-0008IR-TC; Wed, 07 Apr 2021 11:52:19 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/8] tty: fix return value for unsupported ioctls Date: Wed, 7 Apr 2021 11:52:02 +0200 Message-Id: <20210407095208.31838-3-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210407095208.31838-1-johan@kernel.org> References: <20210407095208.31838-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Drivers should return -ENOTTY ("Inappropriate I/O control operation") when an ioctl isn't supported, while -EINVAL is used for invalid arguments. Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned -EINVAL when a tty driver did not implement the corresponding operations. Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a corresponding Fixes tag below. Fixes: d281da7ff6f7 ("tty: Make tiocgicount a handler") Signed-off-by: Johan Hovold --- drivers/tty/tty_io.c | 10 +++++----- include/linux/tty_driver.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index ebcde1f96adb..7738514a15fe 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2529,14 +2529,14 @@ static int send_break(struct tty_struct *tty, unsigned int duration) * @p: pointer to result * * Obtain the modem status bits from the tty driver if the feature - * is supported. Return -EINVAL if it is not available. + * is supported. Return -ENOTTY if it is not available. * * Locking: none (up to the driver) */ static int tty_tiocmget(struct tty_struct *tty, int __user *p) { - int retval = -EINVAL; + int retval = -ENOTTY; if (tty->ops->tiocmget) { retval = tty->ops->tiocmget(tty); @@ -2554,7 +2554,7 @@ static int tty_tiocmget(struct tty_struct *tty, int __user *p) * @p: pointer to desired bits * * Set the modem status bits from the tty driver if the feature - * is supported. Return -EINVAL if it is not available. + * is supported. Return -ENOTTY if it is not available. * * Locking: none (up to the driver) */ @@ -2566,7 +2566,7 @@ static int tty_tiocmset(struct tty_struct *tty, unsigned int cmd, unsigned int set, clear, val; if (tty->ops->tiocmset == NULL) - return -EINVAL; + return -ENOTTY; retval = get_user(val, p); if (retval) @@ -2606,7 +2606,7 @@ int tty_get_icount(struct tty_struct *tty, if (tty->ops->get_icount) return tty->ops->get_icount(tty, icount); else - return -EINVAL; + return -ENOTTY; } EXPORT_SYMBOL_GPL(tty_get_icount); diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 61c3372d3f32..2f719b471d52 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -228,7 +228,7 @@ * * Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel * structure to complete. This method is optional and will only be called - * if provided (otherwise EINVAL will be returned). + * if provided (otherwise ENOTTY will be returned). */ #include From patchwork Wed Apr 7 09:52:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 417142 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 A2207C433B4 for ; Wed, 7 Apr 2021 09:52:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74849613A0 for ; Wed, 7 Apr 2021 09:52:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350344AbhDGJwo (ORCPT ); Wed, 7 Apr 2021 05:52:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:36634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350322AbhDGJwh (ORCPT ); Wed, 7 Apr 2021 05:52:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB967613A7; Wed, 7 Apr 2021 09:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617789147; bh=+1jxiKQ2Q4L9ndWwyEg8xyNIvSMH3iSiEPyYdtL1cwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pjX1ityVfqCk7lHz+FyOxEBtN4CWfTF448w8CTP5aK6Q2aLdu5/o1yujUfVlsLSM9 WVh9P0v1B4HCNdPy6TKxuxId7Sdh9ZDzQxPXdcyxUbzB4lsfYof1LmNrV1V9lDPztJ 8H4Fn/7HvOZG9pOSBl3r4vIYaQPJoeLBviOY5DcwSIJUQxkErz8yVIYeUbk3GsvPBk Fa+OCEjZWUEnEC2HvCecFoDi6SVdWyKRwN7kpxAa2L/qYXAGu3eOTbziP9pefF2hJ4 I6GnpV2m/pqHdr27Kb6Bv5go7yem8QaEK9SR0S4CInXmsLlgp87KDwzGJCteYmL7vv c7ASa/eeICZOA== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lU4rE-0008Id-86; Wed, 07 Apr 2021 11:52:20 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 6/8] tty: add ASYNC_SPLIT_TERMIOS to deprecation mask Date: Wed, 7 Apr 2021 11:52:06 +0200 Message-Id: <20210407095208.31838-7-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210407095208.31838-1-johan@kernel.org> References: <20210407095208.31838-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Callout devices are long-gone, but the ASYNC_SPLIT_TERMIOS flag was never added to the deprecation mask. Add it so that a warning is printed if it is ever used. Fixes: 8a8ae62f8296 ("tty: warn on deprecated serial flags") Signed-off-by: Johan Hovold --- include/uapi/linux/tty_flags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/tty_flags.h b/include/uapi/linux/tty_flags.h index 6a3ac496a56c..cf25056d4b27 100644 --- a/include/uapi/linux/tty_flags.h +++ b/include/uapi/linux/tty_flags.h @@ -73,8 +73,8 @@ #define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER) #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) -#define ASYNC_DEPRECATED (ASYNC_SESSION_LOCKOUT | ASYNC_PGRP_LOCKOUT | \ - ASYNC_CALLOUT_NOHUP | ASYNC_AUTOPROBE) +#define ASYNC_DEPRECATED (ASYNC_SPLIT_TERMIOS | ASYNC_SESSION_LOCKOUT | \ + ASYNC_PGRP_LOCKOUT | ASYNC_CALLOUT_NOHUP | ASYNC_AUTOPROBE) #define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \ ASYNC_LOW_LATENCY) #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) From patchwork Wed Apr 7 09:52:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 417141 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 37F9CC43460 for ; Wed, 7 Apr 2021 09:52:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 118FB611C0 for ; Wed, 7 Apr 2021 09:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350358AbhDGJws (ORCPT ); Wed, 7 Apr 2021 05:52:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:36696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350323AbhDGJwi (ORCPT ); Wed, 7 Apr 2021 05:52:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B8084613C6; Wed, 7 Apr 2021 09:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617789147; bh=oJDNnRo5m7mG8WyAHMekJOKQ1/wGAnWuQz2CFqv9xw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H2w/RLOy9MdKRNn/LR0/JztYToahLZMcIGcTQP7bzTpaKsMj5WLMDSHjs58N9sg8t AYoq8b+939gbctKdxH0Oj1zBtQiSnQUo4Wipda3waWTCx+Dj3n4ZE53e/fMj7uG/7R 93JMY5hh84nKj0u9L2Xi/fp0BhGGBsddzFoPp6ftN55tU0pMOU6UGF3KIYAa39t9gB Jp5TW57EvuDBHORZfhsh+Iyr3t7CNeJuKdiBCh97Q3YkA0vF6hBNDKUJ5N7rA2rsOb X8sL/bBIlnSOwsku5xZpQqiuQrHkNO25MYsIM5d3rdfR8TjMnWfmwjML22ldSl/Ena 1xNYNBR5O1Clw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lU4rE-0008Ig-Ab; Wed, 07 Apr 2021 11:52:20 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 7/8] serial: core: drop redundant TIOCGSERIAL memset Date: Wed, 7 Apr 2021 11:52:07 +0200 Message-Id: <20210407095208.31838-8-johan@kernel.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210407095208.31838-1-johan@kernel.org> References: <20210407095208.31838-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Since commit 5099d234a52a ("serial_core: switch to ->[sg]et_serial()") the serial structure passed to uart_get_info() has already have been cleared by the tty layer so drop the redundant memset. Signed-off-by: Johan Hovold --- drivers/tty/serial/serial_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index ba31e97d3d96..59336943a86f 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -759,8 +759,6 @@ static int uart_get_info(struct tty_port *port, struct serial_struct *retinfo) struct uart_port *uport; int ret = -ENODEV; - memset(retinfo, 0, sizeof(*retinfo)); - /* * Ensure the state we copy is consistent and no hardware changes * occur as we go