From patchwork Sun Feb 13 22:27:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87320C433EF for ; Sun, 13 Feb 2022 22:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TMcMgWNbtGQZFR5deS5wTNF5f4PaaZYVzwivLdBo1cc=; b=I9t8+Xj0pJm5D3 8jnTsixqhHMGyzq/1DbbJKz3OGmHk9kvvLxaS2rvKuL0oqE7yM7MGRDDJsSPjZI2PcRJ1y1Et9iAX /7yk9A7cKw7mjuZ579Gmk9PMEgjYYlJv+qZ8gVtDqD78mJB0hvUc3KAImQg3Gci6TwM5zEA5g2N7n DVQGtUI++9nXtddNvpjeywSOJ1gyhcQSbtH5KnJ0vT44gy8QbTGgb+9K4bCYa5xn1CRr1NHjvasA2 ZBZHgbYJD+mlRGQlA9UPZGnNj8tEeUX+zhmyVMBIYmxU6BGwUWwpCKPLZLHuJ/lk2eK11K/ySAsRn Ib8UFhkFTpPFL5x7Rdxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNMq-00Ccow-3f; Sun, 13 Feb 2022 22:29:16 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNLy-00Cca3-57 for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791285; bh=bZh7fD3BxcL0U4ga7XTlAYTEC0EPT7y619IUOjTzv7Y=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=RG8BL/3hnOqCkN8Y2FE9lEVGlXBqqK/fncb4/LOQmAFJUicXB1gEOXVvp4NT8gLkw ZKZhqJGA0wx6NMgIpMIvMGfy8E74XlHo0TjNXC2zu6tyilA0CPugWs2HLCLIphHWTm bg7uEUU9SyC2jP86Jd6+SEL7cVg7eBWBRiMeFgdQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N9Mtg-1oORt22z8W-015L7F; Sun, 13 Feb 2022 23:28:05 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 1/9] serial: core: move RS485 configuration tasks from drivers into core Date: Sun, 13 Feb 2022 23:27:29 +0100 Message-Id: <20220213222737.15709-2-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:a70uNS3aT4SFE/6OuZPcmU57hS9z6lw3Arpt/2q+1Rn1DqngY4I cqop7d/eCjPhLHz9sZAYXp8ibRRdjqeKMEGk6i8ckZI+xCeYiAixStK8vfEAdAWCt5bZW84 pGb79r9pJC9KWgmT7d2YGAKs5egMFgBpJUZOpsIxXRwVf4VSjo2bXW3br64Ayb/nGyae5pI kWJYGVzKhf3TfZQ3c5gGQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:MDKmZPIX+AM=:ejUYpmz5XajPfujXJyVH1r 6U5CuIact4NZYyjNF9mVhmobMV0e07iJ4mCXAx4ROMgDPh7A3JRkJRSJV/wkYFlAP+VoZ78pK g02bb+zcTjvvE861GOmg9BoYt2SwQDbYzDNGCMuSCAtxrLb3lOeNxiDz/R7Ar7SKYwySmtJr6 cfsdTei2CTSAhUuA2EQcXYyXLYB/pJInKD9MXqTWe8KGJIUAp2aw0n3EZw1UBlBUgQGJqi0f0 OkLZgRgh78wArN4U1F3wN3tB8hzgLs1biB5uMM60LaJFW7udSr4F3nQ6m98++9d4iQYJvmnL9 FSFOblc8Sjv6NvhVzlPx0W33923AShxSllwYRMc1MF8LKq76mUylFA42vVDAN8fPVJpOhMtGS k09UMyxLiM/OMOgATAnPrapuRx4ZOadTIIJBPV7qSnsRAX1BmrI+b/kfe+8h8uFelOZDTd5wO DRvCwCiqw92P+Yb1+V78K0USC8twVnj2obidAcCL1Ee9KdfA7z4J0S5ye30pl267/wJ6EIO4W p1imaaUvPWf5SOJtcWgcjeiIG0wU9SwFtRcdWJLaHtyyK/omsvojPZzhJdo/jiC+d4UuzbIBZ Io6/wCF5V9Pe4Mn1y3tgU0KsnA12OtbK49B2EbbVyGzf1OdnskIuIG6EsSjRiBYasXRcU+JK/ sVDPSxcq0sL6H9j9G7HZLcZ0Gzov2cqL0ZBSC2H9ry3FAaP4b7qqT7PFpX4yjamASVlQ+9kIZ VxUcXh93S671T8X3iWE1F4C+/OkJFQbDdQHzY8b2vxN/gJF5MbONEN3Mf4088+PSw5tr+RuGm zZqTDn9lV7H9jfTVPDdzar9/8euBOL21p4WjxJNnJdkq0VhBDlKA1QBRFusl0tld/U3dz/+uw /nmhlUrgHj0OV8xv4GCUAdEp0U58ArKVzYrocYuu8mvQAI9WMkHpWvxsZEUcdOJem7jWUn3MV tPOvmCzy1o7b7Y+HClYbxJFlSej0xOuLabHMF1D7qen911i/aL06ILU2l4ujGsiU/79Q4oQW+ y5GQAwDhb0/l2UVr+pApKj32Jxuc/FCWJT3VAxG0vPlaFiodRfoj21sV6OvD5mhkQJnQ+sMu0 sw1NHPFrvIt81k= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142822_533522_57EC166C X-CRM114-Status: GOOD ( 11.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Several drivers that support setting the RS485 configuration via userspace implement on or more of the following tasks: - in case of an invalid RTS configuration (both RTS after send and RTS on send set or both unset) fall back to enable RTS on send and disable RTS after send - nullify the padding field of the returned serial_rs485 struct - copy the configuration into the uart port struct - limit RTS delays to 100 ms Move these tasks into the serial core to make them generic and to provide a consistent beheviour among all drivers. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/serial_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) base-commit: ad30d108a5135af584ff47f5ff81be971b6c26f1 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 846192a7b4bf..3fab4070359c 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1282,8 +1282,21 @@ static int uart_set_rs485_config(struct uart_port *port, if (copy_from_user(&rs485, rs485_user, sizeof(*rs485_user))) return -EFAULT; + /* pick sane settings if the user hasn't */ + if (!(rs485.flags & SER_RS485_RTS_ON_SEND) == + !(rs485.flags & SER_RS485_RTS_AFTER_SEND)) { + rs485.flags |= SER_RS485_RTS_ON_SEND; + rs485.flags &= ~SER_RS485_RTS_AFTER_SEND; + } + /* clamp the delays to [0, 100ms] */ + rs485.delay_rts_before_send = min(rs485.delay_rts_before_send, 100U); + rs485.delay_rts_after_send = min(rs485.delay_rts_after_send, 100U); + memset(rs485.padding, 0, sizeof(rs485.padding)); + spin_lock_irqsave(&port->lock, flags); ret = port->rs485_config(port, &rs485); + if (!ret) + port->rs485 = rs485; spin_unlock_irqrestore(&port->lock, flags); if (ret) return ret; From patchwork Sun Feb 13 22:27:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 157E2C433EF for ; Sun, 13 Feb 2022 22:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lTlvFMRHMhsEapdMh//UvSRYc3DQOTpHc3QlcYw4pMA=; b=yQimJBMY9NwTJk R1+kmWA64QLfIHN0WrPngsZwaf27pfv2s++TAbvkNG/3DUXGwg0DAEtNGTogvZzjFBe0qBnAOhGsq xYk/XhtN8x35vugUJmQehmjpGJ7cFCx4Wd5aTVuNLLjLO0NmiOXVhoZifFwejGThsPT5SXZAged5A fQH5uYKWlL/lKn+oqRjjzepgmyHIGkUjdulpzLOeLGQaL+xihh9wzozdTrtyoTD3QEsMnUid77E1q 6eWzCgErCXD7bDk0n/vFgX0+/V9MFKY1t14G16LX+kNOzbMo3lhWTgOWhEROaj82+UAeKrlY9csgL zz1qzGXH5sL0VgfjJ+qQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNMM-00Ccgm-8o; Sun, 13 Feb 2022 22:28:46 +0000 Received: from mout.gmx.net ([212.227.17.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNLy-00Cca6-8B for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791286; bh=8vbc9twoUnggUtV10g7Mb1U2iiUeZXUFcj4fWWaxiwc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KzjfhcAZczeP42Kc+7eSyADZ3vwREiZGBp9roVilY9ewt2ksqSuI/JvJg2j5kMVxa mJDR7n9ljR6OFNZ3KdB8vhU++9m8WQ/rMSzQELa4K0OgzDUbYM/bDEcT2TBNAGaquk vUaRBtGXKbKYyVlN/aGhNYikGke8j2X9kjaga7M4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mz9Ux-1oEnO23kPb-00wEQc; Sun, 13 Feb 2022 23:28:06 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 2/9] serial: amba-pl011: remove redundant code in rs485_config Date: Sun, 13 Feb 2022 23:27:30 +0100 Message-Id: <20220213222737.15709-3-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:c6+Ys0/CKTSgWjVeoHGhXE+C7sk8b465AsFJvqvT7hz8+wtDILI NE3k60+XHiuNHEj2TtJpphtCYkCMo4QEpfjehlyIIi44xqXykt7VEWB7Quwjm++QSW9C1ok c0kE/CShtmVL3c5kTMdNm8WfIiYMVLwau6yNXOYtsq7yd9HvNp4HA/7w2J5S5dvZYxf5XwA zu8cffo7aTS44giQMVBbg== X-UI-Out-Filterresults: notjunk:1;V03:K0:akt+BNB8rAE=:Bij2tUiEnDYYUcmCI8CH+u A4X+QoGrJhbTtvO81tUsSGH35FOJ9hYG/4EkmBjBWlUTdmgiDY90LejjQ1T1DOWbbD9nPP9ho 0kMwdXf83JZ07EDk9e8rEFIEUkPTA5YQ76+KUyd2PTsk+krztvyEZUgIl8tVw+OvZ5aGXGPkU WEeyn5ENHzR6Bl7wDAz0XqLz9huU49AAUcCqUG3RQn39totfHr338TqD0HRJD6MLpPpw50xUO fn+H19tJ7/L7XojyykiBUoxb0U/CkH6b4AdUkcx27iN/sOPuy3CmMM+EOb22PlE3+A2cy8m5f jRjbW5XYBz1LWtjetZSfMhldFJUenIkLCIcxl9HfNEKPJIjwt6IaNatq3AxzvD/W6qGqbJPoj fc/0DDAQYcghgn32ByxAcVQcxr+ygvkbAdKHTHzjJ+fwHfHDv/a/SeK+YNVagaXmRqlPk810V ziIOIamhRohN/Niu2k+n3mlxrwehLBKh9USfwKT8DfgrnOO2DEdT6srG1qzkARKlto1Qj36gS MJwcGmlPJ+tiIg50bibbbXG3ktSP3j6o142XKCAnGH5NYR8+T+fSrnjr6OtzTaEceQLoPXp88 CnO21q1/l3XdwCgOOF02PbPAl7TwNqP7ClB86ki+c4Ez7ExHt7eklnwxe0+JzA0mo+lFWUB2U ojqgyfDEpcLsZwSKvJ6Vg2e+HZuU0ok3DlnwiePXZhMekSJZW/8Oey4sUIAKrAGJVvcOlCxFQ I5ADBW0EPpxT4xG3XfUefQnfFfsfKiJ+GqdcIXuJ0EBkQ9bzrGmDF77fzKr9qKQh6cd8l1fTy tcs79czwiFw9j6JZ1RP5Z5HaOjUvPf5MrHyAPKDV2MBf5XvyxdPH3XEejYXsYbkz3xqqL6+Cy CNRj5KfoxNsrUxk9G1Ir3wQkCoJc7mhJWP5bcNN97Y/dvxrkBwUKvJnKnSBGvbC8ybIYMy1Nb CAfcQ1+KoVarO2W2L1P5VZPyIucsCrCP3n8UaUAIZW3R8ra41iTBKZ4uuIgPZ/BrMy2TEbjUT spGalwnWvT8DIdqumYaFRpCpAjvrGbx/KtUvYOJ1h1Fn/KT1JUI0yW6PLNFfXWaNJilrNcEtI S8gqQvcwhLJ36g= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142822_636914_82724333 X-CRM114-Status: GOOD ( 12.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already - checks for valid RTS settings - nullifies the padding field of the passed serial_rs485 struct - clamps the RTS delays - assigns the passed configuration to the uart port struct So remove these tasks from the code of the rs485_config function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/amba-pl011.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index ba053a68529f..35c633739975 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2170,25 +2170,11 @@ static int pl011_rs485_config(struct uart_port *port, struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port); - /* pick sane settings if the user hasn't */ - if (!(rs485->flags & SER_RS485_RTS_ON_SEND) == - !(rs485->flags & SER_RS485_RTS_AFTER_SEND)) { - rs485->flags |= SER_RS485_RTS_ON_SEND; - rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - } - /* clamp the delays to [0, 100ms] */ - rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U); - rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U); - memset(rs485->padding, 0, sizeof(rs485->padding)); - if (port->rs485.flags & SER_RS485_ENABLED) pl011_rs485_tx_stop(uap); - /* Set new configuration */ - port->rs485 = *rs485; - /* Make sure auto RTS is disabled */ - if (port->rs485.flags & SER_RS485_ENABLED) { + if (rs485->flags & SER_RS485_ENABLED) { u32 cr = pl011_read(uap, REG_CR); cr &= ~UART011_CR_RTSEN; From patchwork Sun Feb 13 22:27:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DD5FC433F5 for ; Sun, 13 Feb 2022 22:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gDeUQdm5nY9lREFy9HdSmsCkg9HDlOE2hvXPGxT3/i0=; b=rRuEnI8AzJcrcw l2SVVE/qT0rm5pdU9U6aQwEUQE91RoVgLvBFr9fpzMBSwy4dXCEEg4ZJ9VJ9d1RX8ibiPc2EA4D/K vtCnktHI8cx7Ws9zxw3Qc9aP7Y0knpgyGeX1qIma7DrcofuwWYci0T5RrDJUpYklj7wsnAG3ORqEH OZq4LM1NW879tLF0CSAQ1tM8oAUNcG+dljUZhM6Y7qkKTP/xPHdqXGKLw8I9tC8PIPV6hMt5rYAKl uth7gNDmJlzqIIww5CGj0lQMGx8c3H9tryOpfFFQudfIVtGSTite8f6aNfjusuEh87EJN5gLmW71N VhalFpbAHiG9L2YnSoZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNMf-00Ccl5-TZ; Sun, 13 Feb 2022 22:29:06 +0000 Received: from mout.gmx.net ([212.227.17.22]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNLz-00Cca8-Eh for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791286; bh=u821ZeufKC1vgSSd268mPpvvDOICAs/3gToqbHdVQwA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Lt1rKs6vV0DZwnmV3xwwtQf7bHV7mqojHYze30QJ1ujeUXZ6C1L629U1eLWJ52rTd +Oexxvoi/iPn8VPB+PF2oX3YeLc14J70XmtuViPAGc2D0VzfeI/dEJ+xD9qxYaIkrh YHExK1fIv8gEi5ro76YORs1w51HwlnjKzyG69uV8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M5wLT-1nLsS52Jel-007R7i; Sun, 13 Feb 2022 23:28:06 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 3/9] serial: stm32: remove redundant code in rs485_config Date: Sun, 13 Feb 2022 23:27:31 +0100 Message-Id: <20220213222737.15709-4-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:sRdxeSRpCIAmn+my6vWuOVRB84leThgA0NX64DL3hpPO+tdh91W TkrXZLeAshkj2yoQmJj3uD2KRkZruMzX/KMtxlhgSTzxJltILw8O9ZQgFpHE2zqSjLW0fkw 1ZyhFd3k5xZEyeR9yC3h5LyinJdGCylV7yxXMLp8PyYNL2srQU+aiwHqhzDOZ/XVFnf8YNw Y/9rDt6YIDtM28DRYlWsg== X-UI-Out-Filterresults: notjunk:1;V03:K0:wBeMAHUe56U=:hH838uO9L/b5Sei0Q7IRLR RvgaN+QhtVNmCFB0d3FsRv6TCDdB11GCeuzEFpDCmfyb5IxdMUtN9fWIJ24rqijPpsbNu3aGY K06/7p1OgQom3EPTu+Q3b2MsIBASOPi8Pm5hOGt51QFHgZS0s2ehJzEClkLmnf9R2XM/3MoUh uc9axeNbCNcGv8I3uF92dVWPZ5KQ2LFQK/TraT4Hcbc/VO2VjqNmluhz3dnH1QAL1HO7Zg5Ft cjAVUnO3vbeRtDKRF+VtEQzYHD2DsKG/6KujZYSYOoyZUv0vRjNVcw3fEBUOSKCcRATK9aSyB xHCUQLYGEuO0QarBD/f2rAFFwSDPSNf7Ol5yutSSQJu497TDejuvXU9II37yZirsfikxA+Vvz Hw8KYUzBWP+P3wqEBBlBtQD4XTBbcXXzp1GB8Vtf0Eyoy0O+OuVrvwQkiWhnZ3lAbCwAmQrDT v88bN79GIibyPmdIx96mZC+zHG3tZBtxHb6vBoCgJ1DGSOXgbOkcSROc71yMIJxX0we8grR5p V7creLjU3z9o3QVxWl9HygZayPnvJyO05yZuuKm/6mmVeRNELW5r3W7aZ06w6DF5oTUvuiT40 fyctoLRv4pxJn+8PKSlTH2QO0NM2HLbFvLJ/5MR29nhpNMKGfA2Omrf/M2eejxxNuwDPeHtAb Pjyt67wh/nygf5YQePB+1DyzvlSDN8rRJCT7Z4zt8Ar7qAWKMruHtmE4zHlMujCfSUDZrqb1g K+COCTsJJQYkt0gNulvzuodYDh+syOmkr05iwiPvVroZI1vttRDskVawncbZLtUQZyVc6KZdK Wx6pG2u6ovMmeurG+sHgOmbNp22muX5wUHTuPS0ifM6fdOjVAhAtPWw3hf1F8Flmzz/wc8vku sQMBM7uIfmvE5O1+SnZWVhIEE683IldpNpht1B1Igk3wmr6JV2t06Tnxe7fYBavuOVNI8sYR9 DpQhZQthkQNsqOrZOtifEpkl2U43R4njR0CyAlQtW2CLOPShFnl9PA3LVWOxiqHzOanTBlYDT KpBGFlkX0hKgdI1eSZRcSYLVRGmZYwc1kiLb6FGXFqAROQlASKZGcsA3bx0T9BlBABvYCZlvL drqj3+91jVGWf8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142823_836534_5B6EA8A6 X-CRM114-Status: GOOD ( 12.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already ensures valid RTS settings and assigns the configuration to the uart port. So remove these tasks from the code of the drivers config_rs485 function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/stm32-usart.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 1b3a611ac39e..6a014168102c 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -107,8 +107,6 @@ static int stm32_usart_config_rs485(struct uart_port *port, stm32_usart_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); - port->rs485 = *rs485conf; - rs485conf->flags |= SER_RS485_RX_DURING_TX; if (rs485conf->flags & SER_RS485_ENABLED) { @@ -128,13 +126,10 @@ static int stm32_usart_config_rs485(struct uart_port *port, rs485conf->delay_rts_after_send, baud); - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) cr3 &= ~USART_CR3_DEP; - rs485conf->flags &= ~SER_RS485_RTS_AFTER_SEND; - } else { + else cr3 |= USART_CR3_DEP; - rs485conf->flags |= SER_RS485_RTS_AFTER_SEND; - } writel_relaxed(cr3, port->membase + ofs->cr3); writel_relaxed(cr1, port->membase + ofs->cr1); From patchwork Sun Feb 13 22:27:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF10AC4332F for ; Sun, 13 Feb 2022 22:30:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cCKNhnZQFhXH8f6A8EwHJ4gdjgnRA3BP1DVomWTN5Uo=; b=nfpEOXKYZGgEaq /GXGQpuP2XDsMobcnfAOfTqGnm2Xa9l7SXvCV95zPSpTbdyv3+9BkE56cN+jBfhjiSgSO46oLp1EB y5On6pR+SWCNi2xgKaSj0/PO8EUDzQDdeHi/zmiKNSOYljSiwtdObI1+nZLn6FmHcH7P1VkRzEUQW qVth2k5vjeVx9sW9JJ9LdCmX9jrIi3h8RRRP/spy0YX806D71+lqQS4jVrU6YjoZ8E8XzZF3SVVrH NsJtiEmPkkXYpUMPm6XZ7xNZKXPdNsuI+DSl2A2Ahlu2x8mzkZAqCdy1Tka5mrh2ENzUW72viwCdn oL64EFu+ws+pgmTOh9Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNMB-00CceG-LM; Sun, 13 Feb 2022 22:28:35 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNLx-00Cca1-UG for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791287; bh=e4EzhSBd05ZEK5ajCopJGbJXFDfnsrEfcW+jvd6E+EY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=STLst4lAjQO2aaHoXQIhOYARHXJ6XlPxmkJVoAUQjQFRwFsmEa6HK8w9yRlZ2Frq+ X5WKn5OybS/dtVHBUkEF1FbX/+VZF60pvi/pwdCBWWAyMsbJIVkbh8U90UU4E7i8lE iEmlCPQrK0x5ecSF9u62iJZypBMyqMJ21SeXO848= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhD6g-1nxP7t2Zs2-00eI2N; Sun, 13 Feb 2022 23:28:07 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 4/9] serial: sc16is7xx: remove redundant code in rs485_config Date: Sun, 13 Feb 2022 23:27:32 +0100 Message-Id: <20220213222737.15709-5-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dCybVK/xN3+Sufq+aIz+9f9d8QRQ5K5pMV3gwc6qC9O0NCSdf1D cunb/0Yy49nK2WJiwnG/+2iYNACFAlKyWdWsfvp1naKMMsRuUqdzTZzl+xqlpHZPw3EmPHH cibXWxB0zOOjR1LwlupJz/gBg3u2f9jFJ6mj2wZ/7+fxaGmahcpW28UDocXGZCRFeRNrbCQ 4yjiBCc3/e+QF/Ah5zyTA== X-UI-Out-Filterresults: notjunk:1;V03:K0:aKkoKQM+Niw=:w9opw6DPjw/Opr/KqbN+rB ymJPaf8mIS3FNLW6vprkomZuQPEymZTl0UWHNblaHbr2eVcjj0v4jPn1+aZMOmUJxXzNaDPRu cl/jG1nnV85ebW5mQMzaX2D1zMavfpclrQZzcfqFJxWNc6/XiyW/DIxEGC91Bi2OAU+qcecUK PtF0AB4ecTlLeks9vZ5ZzEz7HlnpiqhULNBANP28WT8O8BIRgQxsNSJU1ve2IEuyjxM/jRqLI R5E5FTLBMsz0TNDuJxcoxvGJxyywfi4p5RFuHSkcJBLdbjR6RjiV9Vf+8y9RQAJ0Pp5yYP617 Gyu7uPrN57ueFlZ5U2zN+olfpRIS1l5PgAfdgNDYtG5N6XKH3lUm4mXP9B0/5r5PfPp4IhihX 69Yyh/SDBERp+KX+Jw7erFp+RPXmqiEFg3s5qb3n+VR7NH88Qln/5HxAXADiNQ3vnXQe/fUm3 HSi4Km7WVKlREaH2NUEOMPHVTg5ZSnmkMJIOU0czn0smQ7I5TBclbaJTUyfpPDOjK5ycz9lP/ dMKJpRJ+gXZ5FKYSIgy582WdV1jOMY5AK3awmoIUlku0Q6snbZQwmRmWxGOD/tyAd5RxN7xQd EIqDRkl91q7i+cnp7O8PZ1I5t8NJz1H9t2F+RnabTbV6hmU2oDphzQWa6mbOIikX2Wcs4vEDd SF/4pG4UUMyPj5UhWlVbhELhIIemvbwZ3sqaFjUUaWttAKwLjaNJWWkJsK9V/sopRI6lC7n93 NeuByx7DUAgFTtNTgYK2C8Rb+JCJbek0KccgEmb0FgUKVgrPCsbSyfjit0pA+xo8adLUa7tkH zkPPErTGqjGygIKJuCkrHG6k1rKAT9HnJ3EOG9f608BZ22fZLz9lg1eqsQox1BDzPtI9RHeJG sUf++xMp5s00HwHoWGHb1cvEGMvGvBwcyipAcSJ0sRThVmhvzZ01dEZ+YD1DiV0zHJPrFiINE vCmcWAScBZi37Un9UsyuWC1Dx70yr6azZw3b+6+HCi4gbBBMNO9KY+6nVEQX4y1pCjvc2vWM8 M5ADToxSgoxi5sck+1dE7c8YTd5zNGA37Q6A8fmAxwt3W9eyDVd3fVAJMkoZ8Du2LfWVvGp1B V88fCP6jF2XSV8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142822_337779_FC904648 X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already checks for valid RTS settings. So remove the check from the implementation of the sc16is7xx drivers rs485_config function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/sc16is7xx.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 64e7e6c8145f..730f697bb517 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -959,16 +959,6 @@ static int sc16is7xx_config_rs485(struct uart_port *port, struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); if (rs485->flags & SER_RS485_ENABLED) { - bool rts_during_rx, rts_during_tx; - - rts_during_rx = rs485->flags & SER_RS485_RTS_AFTER_SEND; - rts_during_tx = rs485->flags & SER_RS485_RTS_ON_SEND; - - if (rts_during_rx == rts_during_tx) - dev_err(port->dev, - "unsupported RTS signalling on_send:%d after_send:%d - exactly one of RS485 RTS flags should be set\n", - rts_during_tx, rts_during_rx); - /* * RTS signal is handled by HW, it's timing can't be influenced. * However, it's sometimes useful to delay TX even without RTS From patchwork Sun Feb 13 22:27:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4130C433F5 for ; Sun, 13 Feb 2022 22:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mij/VBHbrGpd/8gjcd7ywqeqrR4Jt8O6pRwD/8LBwKU=; b=ngDWstmg2SRwE9 4FrN7ne/iK70gVLVg4jsxN3JQerPWokoMh3zZN5hLnc2C6RQDAPEcbzdMNSgqD9lX7e+KI17Ev+H2 o/fiUzMGgApcLsf3kokaGlHNjZVEdJRFTYSzx/aUbbNHpWWhp+2XGw0/m7oRYwgODndk/NA/daBNq 5Qhi1iWw1NDf+776gxhTgkb7nAI3ZE2GwsoA2QZzW384x8uz3JPDVFZ1XwR5uNt/mpQKY14qe87Jk NxzXpGMCg23SEIV0sGmYCEeyZoQkUlRpRBPVHhHM+XEHv3LJdnA2ptcKcyqLkeh97QpsyXczYlfIL Bl8hn0wePIK3YtlN+iEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNNh-00CdGE-D4; Sun, 13 Feb 2022 22:30:09 +0000 Received: from mout.gmx.net ([212.227.17.22]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNM1-00CccP-ND for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791288; bh=uj5taIEdJ6Lv1V75u7KWN5Qj+Nh06Is1dtaFBls+PDY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=VcjeUSqNk2wot0DmejNVMqJC4kPZH1pndSE7mesHbhU2Ghjf06Jo7tD38k4uGSx8g Ytr2/JnEmmvy6VCaWVh14E3f9uOInAoMpGqPGOqoHxy1RYdrqbmOhDtzJnE7N97FUf XdBdTwgzV5TIqDVTzUWCZnvk/xXpQlzOW6eAXBm8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MMXQF-1ncPlv1wIB-00Jbos; Sun, 13 Feb 2022 23:28:08 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 5/9] serial: omap: remove redundant code in rs485_config Date: Sun, 13 Feb 2022 23:27:33 +0100 Message-Id: <20220213222737.15709-6-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:X9sHYupZQvrcHlgLqYrbYPQwoslXDrcL7/CgGZCd85CUEbScmXQ dgeYkd3PBvcxbJEL7xGCejBKonr9VJtpen2Uv4WLxIm7wRH4tITAaHpboYWG1qTt2Lefm3F 8tzfOiBftGiTUQ9A1ydNYN7oQlx8OzcyCs9JElxoTYJHcceogCLGQaxeOGIQaa2Lv8aSOjM 7Bo8+KL6CI45Lzyb57W0Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:Ec9qICE4XOk=:UlzKclOOGCV1qRQ9Db/6ke RW513ewoMiyKZtCXR0QKOTLX4RKt7nHX09jCx0o0tY+Fconkskawn2ztqK0Hq8ihY6q4QjTaK 7vGm/HcFS4MtA8tcAEKBfwA8qTRoATZRQik12DmtOnsIw5MyGsD5kEVKg7fU/SYLpP7DOC9Bf 4XbhbXvxbTTmRnCQRD8+iTt3gnZ7PDlQf1LIPNl88GdN0+Pxawr0Bc5N81fBSkBKG3qUUDy8c Aw+dxXCK/RSQMsofeEklJtEXgvsQ9hwkPq9ezK4PxmEmXB/cibHCGi2W5aqiqY7Djfk9tDmoF 84CqYplVZRBuqcZ0HCMhg0XuvBp1QM/ms2LiQYzOtUZbJCVARCrv9yHpdUk7hdHwnkhkveEJv MPhuE17Glp2ZfrP9rPhzi/wBR2cbiuyzLXnoP1NWQ48L+8qGCXB4eZWVKxxXXFDvE8He6zlck S5wWH/Nnfr4WPFLXjx93XLd2Cghy3maT0M8yXB3aHohsHvmiPyzlt1kfYKjXmky8xFNP6tyEZ 7KnsSHPL47Kc/yrb/k7creK7Yw1UqJ/FUYfIIN5Fn2Eyze9IRtfC0PIHn+5wD7XZhR6hZ++Bl FKrPw39cCn9VC8hUkylKFf8mzx3rqerjvc5VLqNatq539QtLnuXA6ZeQ2YU+M/CNJO0rH1Td0 ar7qJfpddWFdqD53nw3PkSmTvnqTsHyQB4hLB7gyktKO2I5uJ37wPO3fLXOzKA2RU79/nqGJJ FQqbBcn64c075PWlfl7qReNsyghzWwD3UHEcuD+6fZCYq09myaE8IyHE8v2Kz/WrEaKEn4gPI hc5voNQjf/YMpigjgH+LgoA1LjwU65POpdpv9mom62MS2UuQ1MD5Ny7mvs8uvA8Ptk9U6pTPX qYmZMKeGc9KkKeOt08jSOXBJzOSRx8KFs1Wtpa9YgCqHn8X2Xnc6IVxl8sQOw0faLyY8XMXEB epZdd0AI7l8rRlP8VCTqPh1YPlurOVaOEA5QwTIWytfjYZj+xbErOFG4n1PFWMvS1xWE5JfdA HKBCjuxiynaPIqIHqVCyN/9Ej7bTg39IfaNSkdlwZ6T7wKk3yXsDrQQhNNsMouWZaPIkCH+Kx z434pcfy3F+a3M= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142826_080990_645B595E X-CRM114-Status: GOOD ( 13.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already clamps the RTS delays and assigns the configuration to the uart port. So remove these tasks from the code of the drivers rs485_config function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/omap-serial.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 0862941862c8..a3afcccfbd96 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1350,18 +1350,11 @@ serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) up->ier = 0; serial_out(up, UART_IER, 0); - /* Clamp the delays to [0, 100ms] */ - rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U); - rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U); - - /* store new config */ - port->rs485 = *rs485; - if (up->rts_gpiod) { /* enable / disable rts */ - val = (port->rs485.flags & SER_RS485_ENABLED) ? + val = (rs485->flags & SER_RS485_ENABLED) ? SER_RS485_RTS_AFTER_SEND : SER_RS485_RTS_ON_SEND; - val = (port->rs485.flags & val) ? 1 : 0; + val = (rs485->flags & val) ? 1 : 0; gpiod_set_value(up->rts_gpiod, val); } @@ -1372,7 +1365,7 @@ serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) /* If RS-485 is disabled, make sure the THR interrupt is fired when * TX FIFO is below the trigger level. */ - if (!(port->rs485.flags & SER_RS485_ENABLED) && + if (!(rs485->flags & SER_RS485_ENABLED) && (up->scr & OMAP_UART_SCR_TX_EMPTY)) { up->scr &= ~OMAP_UART_SCR_TX_EMPTY; serial_out(up, UART_OMAP_SCR, up->scr); From patchwork Sun Feb 13 22:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF0ADC433F5 for ; Sun, 13 Feb 2022 22:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CnbvMahy0QluML0SijsZbnSLAMbEMrts0uLnA9yKtw4=; b=0tamF0kVuE3NoC ep2+dX3V28T3UM3PHCafJ5b842sWWfoto6PEEfjXBc/qaM0QUCtHl1eBRSYSalKcQ4lfKheIyhKwA KqGLqfSE1FUA0tDWuknXagRfc19EPignFSGzmNpRppSE5r0j+Ps4oBY+CneOhrVDfRaajDaGtNnet CMSnEx94HkokmyPRyGu8s4/TEJlRrUSXfpRimlGQJ1rznDdrXl5SvnJNSPYNhzpdRz4OshpgP/i8G SKkCxHP6pmOOa4pVtuCI2/y5omS4bOVZpK7i9qFdGv/VSVfF/RHsmU0RdbkTSv/9OFhR33+N62gr1 JuFPo1Mp62iySolvEXzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNO6-00CdVj-Tw; Sun, 13 Feb 2022 22:30:35 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNMB-00CceD-Do for linux-arm-kernel@bombadil.infradead.org; Sun, 13 Feb 2022 22:28:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=qLYG3ShC2H3ubPzsSwJCdlMrSsl/GQcb1NMteyXFxUQ=; b=l5vPHHpbjNXqgxF1Bmye9jk8+Q jbJCldwDKbkYrOKOJ109zQHtNF4kVIcEHPHetHI0lWDiSsgNXicZe132pOi3RCLypf+pneXgN/SRs 65yZ/atZG9p6ZDSaLDQ+Ep2CCQlx9WFxOuiBKU9VdCh8OYDL+V8FOP4Jgr+7dVetYcjQpEfT5ochA cUtKsuXL0TPwne3Gh1fcXVDbxq6MNo6+lyXUA00OTQwKZFATomXoz9tlrk1CzAumN58Atuzx0mN6h Ga3HYcpsGiuCswQV8MmzqVOYNDWP7ZQWTYGaeoI3n0OP5n1kuevay9v48BZtoEGP5kahTLeiElsDp iOPTKp4A==; Received: from mout.gmx.net ([212.227.17.22]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNM4-009kpv-Pt for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791289; bh=qLYG3ShC2H3ubPzsSwJCdlMrSsl/GQcb1NMteyXFxUQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=lgP1/MpdcAcPp7WHS54cbOSQHqn1sGQ3HE+4zwm10xwkG3C7wQ8tond7u+hcQ54uN JusZjET/+F0Dw/hYVft7ItRNPQFZyprK4024TqW0p9cCpgO43EOLrVGCaRxMvK+bXU DHo+H3RYpGQC23RkbBntSMjv1S/LHUh8IzWAuXsA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MHGCu-1nWcsj2aye-00DExV; Sun, 13 Feb 2022 23:28:09 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 6/9] serial: max310: remove redundant code in rs485_config Date: Sun, 13 Feb 2022 23:27:34 +0100 Message-Id: <20220213222737.15709-7-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:pNx+oEQyE87SI8SUhuYE/49GQx6eFVSP9sCHmwT/ditRcv0ylZN rkC/z0D7Q2MUrIrRUkpVmA71yNbDTddrfPtrt8KCP/4yOZ2GPb61Nh3ULguiKqL0WQstrUN QGKtvqxZref4S6azX7N1AacR+IVk1yMV8IHdwiZZEUXR+W4Bo/HkFSxPoooN5TYo9XQpjMZ K15CBILg6Irsn1kmnCbgg== X-UI-Out-Filterresults: notjunk:1;V03:K0:2gMVRpGJ+Pg=:zWCMeP+npjT8Y/OgwGxOaG VMCSchLMxUMyAtHOqgp4TAJYxw4V54Y7dRP9R47RZn88AnOXCBib0+YGubMvpcd8wThqHSC/8 Nwg3RxXlciQGdYTwDzyx8nuJs0+/HbiqeMRcc6iVF5BT5djY/lnnfRKlMY2Tqxen3hNNcrzpe hAf/S9kELuCs5w8/zl12hULu07GN/u5aR6jS49nBQ0k0wRd6Q4Rzw9FnolG4+TYpx09Uq+/sN EmxqPxEYSXVSId9vb0wL8msWTg0RPW5c3MDGG/PpyHsluHHRsdsdqaPQOK9jJyN0nIq8sRCFd 8r8SqmskkiM01Amycn22xIo6ZeXMu8BTfcgSI+ixEQ1B5LnYdeeDFbHh1tjhfzUj4jsdpQAmg 5Ojw/hI8b+Nv08Ot1IM++wHBCKaRMfB4y7aajEkh5EetA1ujxusE+YMMMvwabFtv5Yq9DWFp9 PmJ2r+9RCvHsSf5+Wd9QXNdCenDMhv8YQCLR4mrjolo16/BaLEZHVGvJ75vCiS9S50XVYTxWQ kdbWAklmpKik+nXwIOIeXvrLoSnUwq1rnxq1i5XJR3YLdANcT65ngL6ls4PdhF19EyND6a/NN dPyj9Zl0VJR5UFWUcI8WiLXEWvvKmwjkuve1TkCzSIGljdioSA7J1HlLKNKUF/+8Ie6RxzwS9 zEpg6d6V2WFl86pvi7SQitcRPaCq9U0EHUzHr7Ius+yD61O4YQJn3/giZSN5gAeoSqydxWHFJ k5tlDvtOk0BJFuQtYEzQR7rGv53UQZxp5+agsffHOEoBv88OiOb9eQ1bn520pIwr5mnysCJVa GLThz5R3CXjBoNNKRh0Qj+LGF1QzEED8OO7PRFZFOLgIkEO1a7aFHGKyttq5qUNO8kfqgrYbq +mQYoci7vdgPotq87O5yy23/y/53YirGVVURl8+OfGrfurqoV+Xe5+MHBxVrPNBIiIIWvwx1K 6vhzMKZCPdKbtrODQ1jCNQONvgUfe6nE57FtGa8paqjR0xKLsOMdlKPGxkkj78zorK7Yeu6Lr df24JZAl9ZhMZOco6ake+ytEyjjVIPKgS6Hxzie695CjJ+V2ZSOZDw5zekAcMdIcTDsKmbLJc /Kplh30qc0nLcE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_222829_108190_D0CD51F5 X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already nullifies the padding field of the returned configuration struct. Doing the same in the drivers rs485_config function is redundant, so remove the concerning code in this function. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/max310x.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index dde0824b2fa5..2ecc5f66deaf 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1037,7 +1037,6 @@ static int max310x_rs485_config(struct uart_port *port, rs485->flags &= SER_RS485_RTS_ON_SEND | SER_RS485_RX_DURING_TX | SER_RS485_ENABLED; - memset(rs485->padding, 0, sizeof(rs485->padding)); port->rs485 = *rs485; schedule_work(&one->rs_work); From patchwork Sun Feb 13 22:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5E97C433FE for ; Sun, 13 Feb 2022 22:30:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5IiJfjhKxwzIkq3ynNNoyaFPKO2M/a9HeyTxV+F297M=; b=zsJ4T9U3hRSvCL aWKkfecw3eMKuGLFmQf77PWKGgOobB+b4bZYR62yEz9srg0Gd+6jOEw/wPSTbzirsRJY3GVflD/4g 49MonQqk0UZu1zoZIWSEkDlcbQqbiRkuG+ecKAjBbYBk84LJQCitEO/CCbi+uCMX5D/0rZCCC8cFM R3NiSIC8h9FwgOJC9zgd1x+S5Jpke9d5AiExxouHuLqyq9sDlT9KBOQQ42i5gX92HsS3qL1WiE8eN ZlirzfeTcHxT4glEgUSOax4Wk1RJbEsuvMjK7gv2+NxiBjYy+8HcBVcOu7KGLvbobFlY9nGYTR0Fj SDcmfAVhcKY5Bp0BdyMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNMV-00Ccit-MK; Sun, 13 Feb 2022 22:28:55 +0000 Received: from mout.gmx.net ([212.227.17.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNLy-00Cca7-62 for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791290; bh=5wRzDJnH/MZt0kXSTv+r+X6s4j4DfxLFn8KhRpAsf+k=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=drwtnPZpDdswVRyGbojgh3QOoOb+gOjLQCjfgwFWtLfhCavf8/Z01ndmtAxI5ujNI xwYzXWomVIXPipmJk8bW4cMmzMdFbOreX4iFQ85cmDego2brQgSGfsVi1UoLiJonkg It7BOS0PPSZYtsMRgpEyTUB67w3ymF8rQ0UAzX1Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N1wll-1oGT8l1INN-012LMu; Sun, 13 Feb 2022 23:28:10 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 7/9] serial: imx: remove redundant assignment in rs485_config Date: Sun, 13 Feb 2022 23:27:35 +0100 Message-Id: <20220213222737.15709-8-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:VQAd/OJ1jhpk4ldceF25FblvAEPLGdXjHdVFpiuPSuwADkBeT7V yCfW/CI9M5DgE8+jVQFlBr63McC7604NjY1wWsZ2tTsR7Sozw6+IX5Obol0dSbpjd1lf8Yz d7NCqZrRweC/jyYIQGhtkgyi+wplMUxGkGwA6sEPNfHm8KWDl2h3g53uxVYJILCCzU+VFLU oj5ppYlcbHf2/n11GstWA== X-UI-Out-Filterresults: notjunk:1;V03:K0:5jXlo6iGtGE=:2aF7oQ2b8dRXTmb9YMU/9E N59bqsjvTyI8lRoO97eqDWLgQzLdE4gPbzjdn1pfmvnEHT4fDWcQCiF/FOMJk9p86a7xzAGaQ HIVuaN3kR2sOeUDTcXsM99sQ16YeXQz+x+OrHuKOT/F7lYndAyXeTXJlYate248QxBV/msw5l x+iH9vPNrWEPLsqTlxt3PwVLdPLyiVaJbbP4uiZdrY2SjvpDDKcPE6+8TRWaf15hGuAnBB5ht v/leGM8Zb0gmIBCF+IdUP+ZdWZChtUCA9kDRV5b9aKXpL6kYlQePvBBR4ECgfia57JzBKko0X ISGzA5liPhq8ZDkEVZpfjalx2nj+BaeXOSNFgLFtDDkjR/dRLpHGNmknYnK4/jAod3ja+yBTj f1ilnGiXN0Bx+RraTypO7LQwQmOd21Zu1R6cGHoZofHLgJ48V9VYcrz6B58vCV4o1FkcaSEIi kVBRu93pxzqNrko5tAQt9/V6UH7sY0A+f0DfVF/DbYIWypQfTVhti3lFE6IayJY1CQmHYp081 stHZIa/KyskpiTUjN2WDwUJDGD1HGb63lS08fOr1Luv90vn4ipI01ZsvlNn08FsZhz5pjDC9n z+SRL3zDV1KGjriEZz9aEYB0aehKozbjyp9NpPlbO6KaBLudgvr+RlsLuNNP541zq+Mvek2zp 3X+OJtU9sjnkvjTszBxU8jipdg1QzFPQeWtihfOv2K/nGScHRT6kKcrPGdl8ENs62f7giofdX 10w/i5LAc94AZdWtZ99/UPtgCozBWlnT9jAlHWgLo+i5TIq503XDc/MVt/2kmLT5yHQFVqhJS oRWK/HlT0REhLyiUlsnWe8dkY/Rlzfs9rGu7U8/nGqRM8FJeyxzVOn1tuQxEjXcz6iMRmaYeu PKaWtr4Y1BU/pg0ZlWMM/ovwjeX0IvpNQ0D3wSS2rybaBeU5OXy1hmen6l+5fRSWMYf9vKg1L 6CWY7tBK6cg7FtincYaNvjyC0WgYGqjLRINTzDecW5uK6/XMcpWtjPDsOPeyFCThvY80iQXDG NE7LA3Glz53CKTaZSKpqfYvRj8NfAgNghT/lmi8nxHDkb72oY4uNs5bcrzrQkhaKjZUcLlYez y0XBaXQACqP8QY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142822_541160_BC4702CF X-CRM114-Status: GOOD ( 10.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already assigns the passed configuration to the uart port. Doing the same in the drivers rs485_config function is redundant. So remove the concerning code in the function. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/imx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 0b467ce8d737..ab56ff23e8a9 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1937,8 +1937,6 @@ static int imx_uart_rs485_config(struct uart_port *port, rs485conf->flags & SER_RS485_RX_DURING_TX) imx_uart_start_rx(port); - port->rs485 = *rs485conf; - return 0; } From patchwork Sun Feb 13 22:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1E61C433EF for ; Sun, 13 Feb 2022 22:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KPGpe3kssu8dDQeOquOzvi/E9P2FM39f47SG5vbD2EY=; b=P9oIGkZLW9GJal HQMaMTGFQ39TqnuSFX5EvEe9GlaUwd+zRS2S9d6vPprwSP0W9GLP1TNNiNjlyjnZYLmJKYEftpoR+ IzXI5wBmAlUtgFj3Wzui39FBEux1wBkzexa7dAkXX1gH9GUlpitm+88Tumiox9FimOS84U9uI4Ctl Do4XH6Krz+HF8FWkOx9a+5am6R/amSqVxBnBwIH6sXEIkSJH1KVPoAnmhu++OXj8HQ21KA6hQC3Gr kJrnmsq8SLQHvLu8KGmoyqCSFL1gf1xGJty9uT3SRnN3holKL87b1jHLEOCB5SD6pAuC4DP0PB+rf RDGBZyGg7hTk1b2/9YqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNN2-00Ccty-MP; Sun, 13 Feb 2022 22:29:28 +0000 Received: from mout.gmx.net ([212.227.17.22]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNLz-00Cca9-Eg for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791291; bh=n1QSAdLWsAQBxZRJC/gnWpm6+lTx/Zgz/1kXnTeWbTk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Ewg+pyudUNNhlTxmxJ8m6Y3bDNHGCsC/G+mULYJ8HmmdZKqlR1VpEkkaQluanR/LW KkB4PMKjYTYHzXm1iotEX+SZ41V+5uf8qWFSjAAQQzMQBNrZnMaX2XhNsWyU8hywL2 6uHBxCyMo29Jn83DPp4fedU0Y6PEZJrupTOabWx0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mk0NU-1nz4sc49Zg-00kOyf; Sun, 13 Feb 2022 23:28:11 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Date: Sun, 13 Feb 2022 23:27:36 +0100 Message-Id: <20220213222737.15709-9-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:C/eQLJontq2RLt02NobbFgS16JscCgWH9ptxRkHS5Z0m9OOZox8 QJGSADIVHCm1oXdpAIolH0IZm4dSg8gHv3aQgY5IRT0JMcQLYAzrw6FPiw1+XnQmDkw/xGA W1WYjAcv3FUh6R5QieabywvgR65jtD6wAJRB1A7LCgqcjvv7kUdIfMTyYwJm6rwuRAh/fiw 3G7H1DWGTLFL4eHAtVtHw== X-UI-Out-Filterresults: notjunk:1;V03:K0:GW96dTaR/Ik=:6fYq+kp+ugwqcmrcScHMoV wOyxIc3gMQMRzOuEnq6jtapGs4U2M8+oUbMt40BV043zmHcmQWGYUj8dDBHY1yY6norO36M1n iLjV4E/eKtC9UvCoBwDHvJ/De7yCeltCTg2C4nH0J8JqSxNEFTNkaV5CjJ9PjpwCoyzKvJJXU ViHnDFV4EGwFNkhmIbUOYNJoTEL6FjJsPm7zFEpSPQIVxoaOsOWRGiWuJFeGwvAmTagcv2z+k vgTlgaFGH9VolAQF/547ya+PrpoLbqN7fVImQIofNzcUVOW5vF8BX8ZnG7RQzifTgW6L6uFta cZMkfHowUdQMM1wWw0gsPn0QR+nu0HTJWrrAxD7FOWFTlg2tXeQFecsdzUn6+WuvQLvEQ17Ge Nu/O2UuBw1oHiMy/i96I5iycFskGaUB0veiYC/UferD6jrR0gDLyrvGHkPq2TkrDB59CM5nws Irt9JWtQ7lSpzstneXMh+eSqm7RMsY2pkKyavxomlAj6gJ+iVwSSymmw3qNS6iUNudWVMmmUy X/r15abl8xgXnCwaNgU2nmC6bQNylF/PiBsbLO26fQ7RdRkmmRxA2rCg4QDSOmY3Bgc5WU3sP +5p6nkurvY512d1Lh2RYEquXw+BCFwEgEaUrpC30GXRl9VUQObsZnmUl+FWkinx+jIg3X51lm JDxwxOb99VgRe6pSP672lFY8PTUVzKfnkNEoUPdD5XUy5Gphr5Q0KZrUaN1Pfmffj8N0J2EfZ bico4auJJJ1CYfKartha5WPYYxIKiNCsjf3aylRjLnM69xTBqWBKa8uG8dc51TVuNeocqOPG1 msF45QnjwajjZAddvYbe6F0wJpFU+t7yq229qTTYbtyRNcEOLAPQfTZ0jJDBIainijc4QMaFX rYI6YRkejlmWgClXwy3S68++4/mCEL5MtqBUlakr+0KGJWJL7gX95o585ZZDS6g/Hvi7oHk8C CSr6/n8YCbJpPuuxFyrJTW/o05vv2DoBTupXcJcBbIJgYSB8Uo653tuL3pgZEgi8UZKE0oZ3V GhqGp3xUjYGnnkHcakzt6VkE43zKlAaQDB1A61TL1xDn4dHrqnYbAS3VRFU5of8PXHfKB3pbN OS50J6mm4wD4M8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142823_887047_ADDB3FC3 X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already checks for valid RTS settings and assigns the configuration to the uart port. So remove both tasks from the code of the lpuart_config_rs485 and the lpuart32_config_rs485 function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/fsl_lpuart.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 7d90c5a530ee..a201be44d68a 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1377,19 +1377,6 @@ static int lpuart_config_rs485(struct uart_port *port, /* Enable auto RS-485 RTS mode */ modem |= UARTMODEM_TXRTSE; - /* - * RTS needs to be logic HIGH either during transfer _or_ after - * transfer, other variants are not supported by the hardware. - */ - - if (!(rs485->flags & (SER_RS485_RTS_ON_SEND | - SER_RS485_RTS_AFTER_SEND))) - rs485->flags |= SER_RS485_RTS_ON_SEND; - - if (rs485->flags & SER_RS485_RTS_ON_SEND && - rs485->flags & SER_RS485_RTS_AFTER_SEND) - rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - /* * The hardware defaults to RTS logic HIGH while transfer. * Switch polarity in case RTS shall be logic HIGH @@ -1402,9 +1389,6 @@ static int lpuart_config_rs485(struct uart_port *port, modem |= UARTMODEM_TXRTSPOL; } - /* Store the new configuration */ - sport->port.rs485 = *rs485; - writeb(modem, sport->port.membase + UARTMODEM); return 0; } @@ -1428,19 +1412,6 @@ static int lpuart32_config_rs485(struct uart_port *port, /* Enable auto RS-485 RTS mode */ modem |= UARTMODEM_TXRTSE; - /* - * RTS needs to be logic HIGH either during transfer _or_ after - * transfer, other variants are not supported by the hardware. - */ - - if (!(rs485->flags & (SER_RS485_RTS_ON_SEND | - SER_RS485_RTS_AFTER_SEND))) - rs485->flags |= SER_RS485_RTS_ON_SEND; - - if (rs485->flags & SER_RS485_RTS_ON_SEND && - rs485->flags & SER_RS485_RTS_AFTER_SEND) - rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - /* * The hardware defaults to RTS logic HIGH while transfer. * Switch polarity in case RTS shall be logic HIGH @@ -1453,9 +1424,6 @@ static int lpuart32_config_rs485(struct uart_port *port, modem |= UARTMODEM_TXRTSPOL; } - /* Store the new configuration */ - sport->port.rs485 = *rs485; - lpuart32_write(&sport->port, modem, UARTMODIR); return 0; } From patchwork Sun Feb 13 22:27:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12744713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B524EC433EF for ; Sun, 13 Feb 2022 22:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4md2FxR856fFTGM2BsWTBw3vlqCw01rnEXKSwemkqz8=; b=G6iqy8JP/YJEOK lfTtVlRGwMq1a9DSGs+tRYbsWKhZE/1hW+iYYbu60RbKKV+/Gqt0jTA30kW7wVJPhFlxDjWhhkT3b 6uchMcOdZ+pjR1wTUp5hkbXlb0C7TTCe8D+xVjzjHy/I7A6LmDToHcNHZHnKU08Q4xQV8B+gLVid8 jtfkLdTHw5U2f9QqLQYMMyGnwPGrDRIthRViPKIBcVBSZSxtuNfLQ9xVAtrXD7wrU98eqs1ZRFgn3 n5GHECil1zgLiHQzW874Vr7JMgNQnqkzYxmHoqL4N4cRcpAYpgFumoyvqi4Lb/g+6tkZBzebzIFMo OeBtCAsfTehHUPT0EFKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNNM-00Cd4H-Dh; Sun, 13 Feb 2022 22:29:48 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJNM1-00CccO-De for linux-arm-kernel@lists.infradead.org; Sun, 13 Feb 2022 22:28:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791292; bh=WBgs4UsljChJvlnfHo4GVoBnICbWqNN2tqDkgEeXK8E=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=CwqT8j/XAyjFTenc5EWadJ9L5zmGbowtXcDGjm61u5A4NViTeDJQB9C18zzKcgfor NV+2fjqSdYHD2+D1ciHgMo8jMswyMluyVxfp/6gkP3i41BDsDPAFsqLVKCPTa4jngS lvAAfGK3psRu4EEryVzOA192Z0M885REfOqtiOkk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MGQj7-1nVFpu35HZ-00GonE; Sun, 13 Feb 2022 23:28:11 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Subject: [PATCH 9/9] serial: atmel: remove redundant assignment in rs485_config Date: Sun, 13 Feb 2022 23:27:37 +0100 Message-Id: <20220213222737.15709-10-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Q3ZlTb7isrIm8pDj4u1NbzVTiR5ZqKFpbyFVf3Sdoi4eXu3Ta8z oYr8DGswb8CiESXcXRkinbjAqcyDZxNc8JafBdlTupttlUD+Z9NxWNASfbGJhOPYqeE5I6g ZvCF/t1Zd866PwCgY+foXoupJw53+0IHnS3uR1IJZwozNfOaUy2VzvCWMZzPGb7rd1/maoM 10tuzyU9LtKQuXKqUFAjQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:5Dj1twAEpak=:OVSN2JAe4ZE0uvWQM649Op BL6K6yF8FeiZqlaEr5I98uPm8X6KxeuRNih8e+Wvx9vUuqtst0I2Oz91NdYv/GoipdF3DB1ZL ROOIseNmi8iTFt7FnsKxldz9TE/2WeiSIa0Wr9Ms70imRWn8jQEjPQU2Ij/FfiRgkpTqDruyq CtbWkfIz0MMTauBC/UqINDBQNI5qI+Mt9/DHwkJasSGUkFnsD98EIaWAQGIab51XBWBu0uOgA 7aw7PH0Xi5uh27EFNpp9/+kSYM30xRiSr6YUrLBrs8LuygG+POkPLCOXQCCE2msuOL2KneoIM /q/r2keASCEXJ8YamkC61+eWDzw50epOpeORYUc3L1jJUudPl/Z1BgK8TMu3MoPL+OZViOcnE 8HZr1oSfPnqhmCpIY9dw5YB3btCCV92bkj7zmqLoamUklN/ZNinNF4MFqEvPOJz8ajWz/JDAp w5A8S8iCAppW75Fim5IQTU3AXtSbME1wBRtyNUf2SqV+2XKB0DtiVOqMg18wGXWnTTrTIIQPJ 5I0TCMBrVT4cSlWAgbiDgePjlevFVjthqfc98KJZNPQuuIe1Q19D0hf/mtP6GZctd0qy0x6rA HALXA2kRPj4P2LHkGJ1Sv75ZCLoKf3S0pMvovCwtx2awMTVURxCdCeB5B5txX5stmvARkuXP1 DG2o17SRHoe1aviwNlGS4Svqp4aZfvH4li7XSGPBQ9PggopYWViWxV1tiyI7UGxyviPKpLWeA pvMHAPM7r/Dy0TIBNgOpG3b8g82qatKm2SKUKFZibvVV63Oj2IJpNhjVtUK1FEu1Z9Cdx5B6F 5o2AkcHDK1oIkfpxT5OGEMUaEXP0UZHVMSMvz69sVqTT6pEKs/cdLnE8o1wvBxNBGxRdK9I9j +1zeo7CqBgAG2OMYYrwtvnYhQtBmp52TF4GZzrrEJUnGsHSqiRC5b9ErxqLstQV033DNsMez6 XfSG/NuG++vj0/igLW4ipwhNi29OJkLg0+vGyXq2eQKNU5vYogYnMY1NFUJkB6cfPsPxTKNm/ mb8L+T8L135tc9YFmXouLB9wcMgFC7LZe9eLSbatJ8gVt4U7TYLz6AKBqmM34VRfQC8hJ8Vd8 bBOnRd9txaJJSA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_142825_801462_E70A0E44 X-CRM114-Status: GOOD ( 11.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, Lino Sanfilippo , richard.genoud@gmail.com, festevam@gmail.com, s.hauer@pengutronix.de, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, ludovic.desroches@microchip.com, lukas@wunner.de, linux-imx@nxp.com, kernel@pengutronix.de, linux-serial@vger.kernel.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When RS485 is configured by userspace the serial core already assigns the passed configuration to the uart port. So remove the assignment from the drivers rs485_config function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/atmel_serial.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 2d09a89974a2..2ab589a3d86c 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -299,11 +299,9 @@ static int atmel_config_rs485(struct uart_port *port, /* Resetting serial mode to RS232 (0x0) */ mode &= ~ATMEL_US_USMODE; - port->rs485 = *rs485conf; - if (rs485conf->flags & SER_RS485_ENABLED) { dev_dbg(port->dev, "Setting UART to RS485\n"); - if (port->rs485.flags & SER_RS485_RX_DURING_TX) + if (rs485conf->flags & SER_RS485_RX_DURING_TX) atmel_port->tx_done_mask = ATMEL_US_TXRDY; else atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;