From patchwork Wed Feb 16 00:17:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543669 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EABD9C433FE for ; Wed, 16 Feb 2022 00:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245011AbiBPATc (ORCPT ); Tue, 15 Feb 2022 19:19:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244983AbiBPATS (ORCPT ); Tue, 15 Feb 2022 19:19:18 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F3A9DE2D9; Tue, 15 Feb 2022 16:19:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970719; bh=KNlkTrX8x7yAcANSC5T8c+HtH9VyTbcyT6PC6GXfNX0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=lmL5TL9e+J65+t5P61LMu2xnn2PLAmk9tl1GigRmC544abjRh0xeCnXitGDoqa8Iv jbAIamZm0+kOtISNRSLq9i/v6hNTYAsr7AAWmA+P/zHi2/yK3xQe0Oey7U0dha42XY p3iv0OvZNfnx/WbVS9gFykVcP2t/5i/isqMVlkpM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MV63g-1njwcK3TbK-00S74X; Wed, 16 Feb 2022 01:18:39 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 1/9] serial: core: move RS485 configuration tasks from drivers into core Date: Wed, 16 Feb 2022 01:17:55 +0100 Message-Id: <20220216001803.637-2-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:DwBoOp3Hdle0l17X4ijaaS7OBJw4SZaNDHP7xyTK6n4Ia+pqp61 m5aTrloSjRFLWCErb6bGxl+l45wdG2RZGKpDO8a92NbQobSbg5o8vrxWevw4wFdrF6rYRI6 1cMPsfUCYy9egVD77ZpRSaNixbyqrj8RjtewfB99e/arVo5MJqcq/SpvMi+njnaJDMsdS51 dQrqvKKE9JRUOK6s85f1Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:bmNCB1gxVX4=:J/sglHkC1SJ4i/puh7f5KG dCF/XX0YugPYdaSgqSNypFVuDenNFU+oCu4TKRRwGWAIBLeamPuuMf+aucPSGfwqoqqYTncMJ 4Y2C0vtbYbQYCje6UG921VNMRlWV+ndKj761KYBaJT2X+78KWkMS1noc2RoIWcAN6v/pF1YyH +Fby8SiOTsGBG1mDDTN/ssLKhahM4HkYrinnTh2cg+R5jTurQNhDTfFm+gylQVR1/Mobs/K3M X/8vHQo8fXHoC7b1S2KSlvR2ncMjkFQnlAGmtw+TyBVryZg5PogTjvbT0wTGapNf0hH/Twhux mAgtbfH5jYgHDZTGcQuV4b6Cn8ZBhCVnsK+q0PAJ44GFyHiHk3xlB1Z6LgM/4Mhk3SQZYAt95 HQEp+v9VbHJzldFFRpAnmN4lHxtdoud7052dQJk80JS1fIja/+3A5flzITM5O8xN3fob/PLwZ aKoet4dDHwT1lJmkc6QxgACT6iKX2EdbcJ43kot45O0ML9yAydqQ1LOGfRbI6LyI3nxlC+NpR f0ldMq0bSoIXIiyTDkdoUyqCa4U9jkzfwt9riKJVC0fTWwbD1GpWXjvxtJeppGBbxxd6epXsf OBbRFtP2rYa5Q9gzazfKov7NFaNE0sq6h8eWClMzzh3jISA7+wlgEWfHKcCZuAS3MXLDDS0vp 8ITJrqIIZvQcTeMG2WzcNDXIRl53L9mj6PQUwwz5koz6EL6kI9/Uaj0eg3hPRaUGSsL5F2Xbl M8LFguEVjqKtgnzICeLDLiMYV3eBRHONudG/f51BQhHteKhnY7j8VB8RKhH/mdNguD7/Awai1 ArXuA3seKBHMYr9gTPayeCQx/Ik20Mn2pbRs6XUaAHrOFqH2kRlIRBq5i8bY2ievvJzigcJad Xtny68ZVsbldCPRcHxk6RRaov343h1B1sHtF1FP9NS82gbvPMpLR2jcK41RmFzREE3UKt7U/l BvQEh/nP4YJpnfdhA4LZH9WYP0fDechUpM/GRzRVFvOOSbrhh7z5gjuypt43stQ+xI+0LVLM3 I+g8dcrv00Dv/2ssYMrBKToRgCMt2ZJhc600Jx8OxBsTOf6suchlWHJkb5F8RJMy8BQDNWBQZ jm/PSdl6IbIHOI= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Several drivers that support setting the RS485 configuration via userspace implement one 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 behaviour among all drivers. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/serial_core.c | 18 ++++++++++++++++++ include/uapi/linux/serial.h | 3 +++ 2 files changed, 21 insertions(+) base-commit: 802d00bd774b77fe132e9e83462b96fb9919411c diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 846192a7b4bf..a4f7e847d414 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1282,8 +1282,26 @@ 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; + } + + rs485.delay_rts_before_send = min_t(unsigned int, + rs485.delay_rts_before_send, + SER_RS485_MAX_RTS_DELAY); + rs485.delay_rts_after_send = min_t(unsigned int, + rs485.delay_rts_after_send, + SER_RS485_MAX_RTS_DELAY); + /* Return clean padding area to userspace */ + 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; diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h index fa6b16e5fdd8..859045a53231 100644 --- a/include/uapi/linux/serial.h +++ b/include/uapi/linux/serial.h @@ -128,6 +128,9 @@ struct serial_rs485 { (if supported) */ __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ +#define SER_RS485_MAX_RTS_DELAY 100 /* Max time with active + RTS before/after + data sent (msecs) */ __u32 padding[5]; /* Memory is cheap, new structs are a royal PITA .. */ }; From patchwork Wed Feb 16 00:17:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543671 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A4C3C433EF for ; Wed, 16 Feb 2022 00:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244894AbiBPATS (ORCPT ); Tue, 15 Feb 2022 19:19:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbiBPATR (ORCPT ); Tue, 15 Feb 2022 19:19:17 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485FE70332; Tue, 15 Feb 2022 16:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970719; bh=9lwKvrStVOccoHp+PLQwpjNTIUqYC6p1OopT1OpjSik=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=jJrdsNDsGjNDALmaTOHlXec73KfDH3yQsQ/G2Ps/pQMWBCWc3+59U1VaqZwBds1Re XvvkfySyJ3GcQanUTRRbbN9Ki6x90nrcBItn9iVOUoauH4TZBT7a99jZyZASvsPg39 /SRoq89ZfDOMo7pnNPyVeLqlJrx+I7S9dQaMpC4U= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MatVh-1ns5zw1wJH-00cRhI; Wed, 16 Feb 2022 01:18:39 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 2/9] serial: amba-pl011: remove redundant code in rs485_config Date: Wed, 16 Feb 2022 01:17:56 +0100 Message-Id: <20220216001803.637-3-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:nlUm6+8IP+H8OyDSlYvKBHsZIXLMdKTnPNVnV93RqHp2sapA+yB 4dCFcJu02oLHrtNEFIpZZuMWTXbgM3k+/VVlqH7K/QBcwAfuGT26+ZLwBCE649vwRwf2+qm FwHmtjgv3Kv3r1n1QpSLvvqoOoQOYhpgNdo65VSs3MCvJ59MskMqXaYr/zv0DKrAuB2UV0G OyVfyp+DBzQl0jdru8SUA== X-UI-Out-Filterresults: notjunk:1;V03:K0:AlySP49HIQA=:SLMi1GsmDrZnp8QAjxu15K RbN/rs0B8QYBdXbqjNqkMHsb7r0M4U6DtYKmbdx+IsIhfTrCNqSUGDgO+O9hlHHhwfU+S1wVq 5asFCz+geCSdlMg8185mc7hUw9BoIaAVK4HUlF8zwBCpUj0esK5/axT3yqd2E2zTiB58pgBdJ uMVvEVN4uOgBMLkfC4ZZsMKK9Almakt64rCKlPyLzMiPXBXDWs+U3q5XG0rsOef2F3JYyPvm9 rmEZ4x8jZ6EECabqm5o58NSjOalicEoZ+E2FxlxnSp4v81j10F/jTiY6xQmbymFvapbYJCxS7 f+kNP5tQOyhFZcEVLhYgIWGqW8L5j6m0uTPSivL1LDIupCNOV8ZIj46Bq2LXegaWmDl+QNyaX v9hPKYwkwJZstsj1ycvXIPsChO9ypJbvdEG5VhC1pGMZwaXCsB8RHGlfarxgn3JY37cO0VIcZ xiw5dw1zNJYWDJ3Y1USfV97okuNvsKhI9JSKtjZehGNFulqTixpXEEoyEScrv9zezvd8k3tW1 ms5ydWop3XOKx9GcpYyDYqp7ZEKCS/2R3y+D+si7M2CziQ46M8DBgyUOi8qQH4AEZVW3lfFW7 GwZCHZdhIDpKiOYf/mPusAVadR7vxIdGdIIS+q/ZHdTnuWyYac5GXCY3DIIotqfenR/KtLRmb EkBW2KUBBsAGr9pGrhGAEE0rLNa7gJiAtXCH0x6JWeosvR714lx4dRo6+xZMci9zCDTblR8c5 d+1gm0fRFKSnPDXK0tlsXdCnoq9JvhkDN9A30hK2JfU1fYGuviaKkfMnrQ4BdGm2LJjdy20r9 RGJ7aQYiw+LhKB0iEuRAGA8dYo+V0IiSfDj3hBg1l/tGnyj3w3OhGfGtwtWCH4teP7WDqNz/+ 0AmrXJJ9wAR1tfDyripx5SN10kdwJ7Vv9GEfV8igt92rGVXEZPPwc1eHdP29cEkQu1R5GNu03 Kiq/UdNHb5zM2EqXjDdiNoDGzi8VMTvTHqAtaZVFhOj+VQeWaZLBGnVLsBkxTASuAsJ7KEYQN ENfGxmDP42HVZ4JitNKx78zLO/SAMyDrUVgPRThPE5GBKsAgmW4A+fGm4TSFUmc0zLJaemOsU ZQmHs8PRLjLz08= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already - ensures that only one of both options RTS on send or RTS after send is set - nullifies the padding field of the passed serial_rs485 struct - clamps the RTS delays - assigns the passed serial_rs485 struct 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/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 Wed Feb 16 00:17:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543249 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87DACC433EF for ; Wed, 16 Feb 2022 00:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245019AbiBPATb (ORCPT ); Tue, 15 Feb 2022 19:19:31 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244905AbiBPATS (ORCPT ); Tue, 15 Feb 2022 19:19:18 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60F4DBD16; Tue, 15 Feb 2022 16:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970720; bh=E1/0CBI/y0oOFG0DQ494qpBejRTp/bZTNYxnMsztVd4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=HFuvYcE+MNBWLyomC9FoyVS8iZUVIA35FCPft3kbzOo7mqNpUDxddkaVfQFrxzahc XcqQoyg8Aw7TdmwDv0P3gj5REk0YX1ZDscHiKZlJdyO0Ji1Z6TE427uYdE/1us5j8x U25SVBYNGbWsdWnabJtsuv5WWoyma4qcZqvFBIW4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MLi8g-1nbesa23oe-00HcxP; Wed, 16 Feb 2022 01:18:40 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 3/9] serial: stm32: remove redundant code in rs485_config Date: Wed, 16 Feb 2022 01:17:57 +0100 Message-Id: <20220216001803.637-4-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ku9v7EnP2t/0qx1Mhz0lYhcdypUi6rPN81qUlh3w+IMTDfVfTYJ qfgUGSK0OQK1tkFHimlY4MVxFZ717ykdkF+hFTcFmLeCgAPbBisXiyEdjPJu88V3L164Zg7 3LypsFm/mDYGL1DPVUM+aB9399sL+hw7OeFLyRjuELWN7s/VUZB/rEQsMi1mrH5zr0yOU/R 1RFl5kWCs/RafZsW3lfQA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Hvhhztwvj6c=:d3BfR6Ur2uikuPq3XCa6Hc uj5wIAomeaMd5dZKOwUL0p4kXoFvYzOrCkorvi8qY20gQJ8D1V5GT0FvQSnJbjMlN5J+UwX2z 51aGxYnHiukt3+IZ7TC7xorPKvcVF7bWrMF+q2CGIbpangB3blN9xUVmlxOF+McAkQ+va8ZxW lebuoS4nEL6brGlQEFhUIfxPdkRT8JUgNQN0gokAmTQo7/P4DqMesHdmr/HeUJFmgV+YT0ZKg rq3bI01rU9Bpjf9yrgjRfhrW4WyevnpJA84XLyqmdTjcdjQdLRqRGNkdO+6vDpM1CRwDF16jg SQ1wjKbf1ByPJcdAS1KE7lO1g3yVeZxfkbzVuqLngRueImhEnyLEcYL+ACCwfTYFLAiUtQgkB VZ2A0M5dXaJp87EFvo58JAoXM9EDDhyzKOAa+vskP9kZ6YqdRJ6JnjbJq8R5jp9cjwqMjXL7u Hi+MYuezfMfQoCHoiPxrGGfmvcXc+/FQYngM05REAmwK/mYrF8ENzLYNGNytTmXxFklexXnJU bjtmrMNuuwhVS8r70AFdoJBrVRIqj/46q6c+bqKQLAy4s/KTneNnFHAwqDvXsRi4RbgQIYCD6 2w9+9Yy2NADjsfGE1q4aWJPwVXtCQjWcKrmmB01bS9rgt5/5HdV3jvMi/CeCEgVv48w/HI2ca 2eOoM1Cqx4RpJUC2D0AbWX9P1MkCcSbW3BGG6TO+/rrpuvyt49zJXATB5x71eIc6a0brWCMn3 eKR/bcaZH+YsVCQE9VL9/8AgQ9IbccBR5KJiJP23K6qHDt70UcgP6mujekMm+Hn5rpF3Q3l/G 5C6EE+Hk2z79G8Jg8FzOLh8FE1E4YH6noAcAuBXPDiwmx5ANPJmdPHUHzChQhtZpYbTWG0BFb 4Sm8zZ8voxi+moabEzyywg8y/u42vjZrPWLnJVx4KwahA7uEQvPZUHumh23WwZo3vMd2PSbqd 15XP0hawAEd0UV3eJWAgkqEwxIvtT/RRpCcm1QxECLH/S819AMRht677NjjhAU64EBryQiG3j 84CVJxd0EF8oZv2L3CJHFl9u7ykWf3cf+Gv/JmG6SmDWWV4JA9ewMe11GxghaeC3+qnzk/MaN fQYREPQj60EShg= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already ensures that only one of both options RTS on send or RTS after send is set. It also assigns the passed serial_rs485 struct to the uart port. So remove the check and the assignment from the drivers rs485_config() 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 Wed Feb 16 00:17:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543668 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E125AC433F5 for ; Wed, 16 Feb 2022 00:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245014AbiBPATc (ORCPT ); Tue, 15 Feb 2022 19:19:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244972AbiBPATS (ORCPT ); Tue, 15 Feb 2022 19:19:18 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4B35DCE38; Tue, 15 Feb 2022 16:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970721; bh=Tt2p+xBICfmPSy8m5S6zW8vENc8fwomto2cjA2t2EVo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=i/tKOBvLBEEFkFBYQ0nT9tO9nGYqtIz9t162BQLFhPkYdU3hK+cFr9Bo3PLPyDX6c 5bIAvEF03nYIIvUH7eINBG878X7982n0brjw5LYMF8UveEW5IbbqEDazowMW3iu/Xq KGOSIM/FecwpSk3lFuPIjBfSI2ntkZO/2Vf9l12k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MF3DW-1nVBiD00Pg-00FVKl; Wed, 16 Feb 2022 01:18:41 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 4/9] serial: sc16is7xx: remove redundant check in rs485_config Date: Wed, 16 Feb 2022 01:17:58 +0100 Message-Id: <20220216001803.637-5-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:EEaXsoGNJ4qUV1f9eq7vhlIcz4++hzNSBNP5W6lbbP2Yw6cQmbm tA87Jtta6/ZlyhZO9ogHIAF/n9pqVFOLp16HL+//jSckxHHVHYCCrcR77wyR01fS9pF0yY3 krEZv5p0efq4nUIaQgbuVtYEItqqxTUyNFFX16maBiceUizax+8xYb8yLJzzVomeA3FI3Pq L5FDLGuDpZS2xLqih+2ew== X-UI-Out-Filterresults: notjunk:1;V03:K0:l/iG3p3tGsM=:h/qmikgE8v2UxCaxs/kOE/ R0yuOR4tZdltGDU1QPIJKb75yyQkBxuFPSZ0Fpsm12GQr2lUusfm/gWcRgjviurIRTMBrJlUe qGYuJcf30DLT4qCgg2g6ktC/qv0E6lhJzMd/1ikErW4d0uXgxS4XtWz1RXhzZLC6pmhfTJr3/ HGpFB4N5o7b3oDZAKiSutSfh3B0m/7ZigkFp14J37S1b6Hg/R+WXqXfgTf6HbV+7enSge72IW vL0u6xv1ld17UHrweBdqz/b7yvQEjk1Cn/1EGYZxn1OySL3HZjFfl0PN6JUW0E2JgUuIUfK7N OETd7gW3J18ZKWXWUj/i+bbfVSp95FaOd858JiHtcjGfCIGoCDOd6ojA0YKaG/pLaFxxLxs5v wjJSPGyvXG95buWpCRbZ3PLThIzLytG9+pQ19B9/g9N8bkKPVuX5S9sZxlJFTL4mFr+ehxQSd evQvoJLkY9Jhs+a/ABTE7yA3Qr4l+oxU9ZcQijIqX9LcK07RdXXMbUerCeIKao91IjWV8Bs2d aq36BMefiwRAdWwD6XNPfeGkL6Zol62pKt6Nq0RFR5EQSxDMt2atHEp2ErNQ3TVFZZIeMPZDz r0UTNn8Q+HHBtYszbG33G+I+XDc7IMuLRnedGsWb8YPKPPujoRtYPDm4lLvZbpIlt26GLfSpe croDMY1Sbjle+Mn6z3NGsGj6oc0E7jlweKl6vjj/2LyxiDP1VEdpyzgNojvaq73v7Z6Nih1Pi xZbuIV9ba02MeLAHu/UW9vXCXXUP/hTdlqEPnh6KtNa3s47sXIrCzz+0+nmDLrEQvFRRJEe89 2dyZGL8jYZypmZqrRAbzLZXbB03aLN2qgWWuQBMMetnOxd51nn/jjWTsMRsVOjH6vtC0k0Ay9 wrhVOuSMc+Kt8QWEwL05ugkEKXyWk8cJvNcZ/pJsnHUwFGqih392OmbMbPPQvv27uG+xPBv2n 4Spi5UoDvMjKrLJyaMSrDfWAkUMIGD+LTeWgkY+rDOuSa7fMo0fS0lnj9eXvgUmvSOWzHsj7Y SFB2VtQSQWCaIe06JgWJ+GJKU+Ts8/DiSTOZtpFTduwSDXqH0Fmq4W6gJvTLnHkNqn/0aAaIO kql0RB99FA4JN0= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already ensures that only one of both options RTS on send or RTS after send is set. So remove this check from the 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 Wed Feb 16 00:17:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543250 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2524C4332F for ; Wed, 16 Feb 2022 00:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244987AbiBPATT (ORCPT ); Tue, 15 Feb 2022 19:19:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244853AbiBPATR (ORCPT ); Tue, 15 Feb 2022 19:19:17 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F6D1D5572; Tue, 15 Feb 2022 16:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970722; bh=9fjzLBN+PWaAWLzb25vUWj/J8xwxeq7xuYNRStHQTXY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=TRWqadBfpr7rXZETxXnexOCp6OoWAYSskM8CzJzSwwM4rgEEehYeH93UEQki8dlkm 5GozK644G2TnN/4/WOtHzVm9egbeTz/fJ5ltBzD5OgUSMzWDa9Zyn0MJgjbVLPFhXn FQhIG6pmbAPlxpya9Su+pDVGmegzB7B651sV7oaQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MsHns-1o9Ljs0JhK-00thbF; Wed, 16 Feb 2022 01:18:42 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 5/9] serial: omap: remove redundant code in rs485_config Date: Wed, 16 Feb 2022 01:17:59 +0100 Message-Id: <20220216001803.637-6-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:/tz633QAQ1FCT4Yf0dg8eH/yTxYQTHHuIgr3F7fDKxaDLTEMWfe 0WvgIa6xZbYzyxJbrmhlAc1kl4UgQlreMe4xgdm6LcjZ/ormhh6Gbj6g1SeFMEkV50vusEg GM3o8gWe8OsYLW7m1QdsliQ+aKaQlpWnVMo9orcFLR9YxCzWYXB+G4ACr1wxje7J0ZnDYQg VEBc9+xvvhv1krq8PDlQg== X-UI-Out-Filterresults: notjunk:1;V03:K0:T84ZUqvS1kM=:/YXYpP6Mtxpi/jTICB252b OCIdLsaQBwP5p8uM0yynpYrVhaTyb8JcbJOK1SM41xuT830pDk+RWYGoYSbfPcHmUmGdt0Z0N IWqGbe2qEhzTuuBVLQZr1GBnPr5dXsGK+TJ854uZjqHcBEL4qLcGpnFMxGtmkmOCQhn80axYr WxQ8kRFucSAeRTthxOHkMGBxzjDLf6gE2QLilJfzAex87RuaxRTSXdXw1VyVt6ncMX5N+zx+H B8bhLEMo/36++c7KHrQOXPuFZws7IEa+gPL4cUinBbBBSB+TKvaVdSHl6ILA9CPbOypzHni9i BDveYO3yEBm6pms34fb5vK2RccA5ZMZoSqZA6r2igb/EUAz9qCmFVGtnKlGKMKYzb5Z4+qX6+ RNmHVpWiDhF61OwDVooHKoMi0kRlq1BcAPEIGIXMLKP/Q7GdhLkmWtSi6pK2ytfvxINX0ypsc xvEhTx7WwO0lG2ky7ZmpAOyLB8wgDfJbgtsyJZUjPBKwDs9toJW6Dd38R4RKET675OLqj2S+u O3C/jmn9xNIJ4lYWdtu7VKfpAsH6zRgBuG+mTn1aJLKdeuvnDDVOrnwgM3syFL+iirMfrQfCH lZiA53asWW9Fz5GuKX9bx0ZMft1X8kxLROrmuHFmQ3eV2OEe8BpWcEN5fDIUt920OybHaK0lc Y2EVGw5VDJOQU/Vi27QojPnhOSRmiqH55F0BflxYkdsl6vUdatlEnCsiYEBncGYJg8mcGfwgT NeAhpnZxVs70PXh44kAOdy7jtgyPbj36SNN4DhkUJBySGAzSvpwTE75LYF5OCcCjjeaOsghsK 5N9ONFbDAhEfgPkpSWpPllfYe+hhcWHhWehiBN4B5St0Aem3ptLXFl8OUpvVb0ppNT9rE9rbF mw9xMhFAremA9ks/3NWW4dBkakdOsDV5N3XGs57uwCGR2GCo6uAfaz9Vge1EG4txWZMtfOeGW nfq6WbQg9tT7UGeF58rpUHd9QuVAg9JIHpzY9T+VPg4nXBQXCAG9+dINuQQw0nQZ73XDtxUEv Ss4TKSOWU5N6Kl/F/0fNoMTzru6kFCUHKBgil9mralYkoo/GGS0E2j8ToK76EUf0oYEq4Zazt vWM627MxQ6T3LM= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already clamps the RTS delays. It also assigns the passed serial_rs485 struct to the uart port. So remove these tasks from 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 Wed Feb 16 00:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543670 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACB60C433F5 for ; Wed, 16 Feb 2022 00:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244984AbiBPATS (ORCPT ); Tue, 15 Feb 2022 19:19:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244848AbiBPATR (ORCPT ); Tue, 15 Feb 2022 19:19:17 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E680D5F4D; Tue, 15 Feb 2022 16:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970724; bh=lQa+jzYKtWp6KPdLT/a3HxqzMlHwKAFbTOnPK9FsF40=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=XZQ+M+AO+wB74+I1fnj8BkEb+9CR3jpL3CTOnF2YHrX3pJ66yddgdz3mjzNT1UGgq oDrfImn6Dv0cHTzDLDEW6w47mTXazsKIAxLd1s2Ui4EQ/FyJAcswqSv14mj3INzMdU ctPus1IPg5EXKD+DDrzGEVLBs9hwk8Z3ai94w/pw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M2f9h-1nHfK93YRL-004DLI; Wed, 16 Feb 2022 01:18:44 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 6/9] serial: max310: remove redundant memset in rs485_config Date: Wed, 16 Feb 2022 01:18:00 +0100 Message-Id: <20220216001803.637-7-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:28MycnKYVIB7UlJrdb5FGLVDDUI7YjCcJKyT8XyTdj3c1KUUJzM yHQYiA0dsl5qqPPMN1Cb3K5J18csfM44YW3gGHUDdUEP8UfU2F0y/O3WpJKfaqgdPrH0bsJ QW0mOmLfrK9F7f59Z7Uw6WlEetyWbFfcVZ0bQkpWI+nF16kGriZ8GzkDzCC1Dq6kOHEsXRM es/oIPpaWxTNtIODzYBOQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:2PraAB5/itw=:tiTHeVTo7ob0QfR/7R4HK/ jZtFrlwS14tTg/dSVs4zj+8VMP1VlVYYCEi12Mr/LTKG2EkBUEKrq4vxOP1Hn0yJui7t59Dca WxrXIMsm23aIL358IhO1JSRnE4oNvFvEV+9swKKG6MSEaCLkHVrbUXeeco+5OxtyUVoK4qBwK qOJpr3cDFshGEVew++ZM3V1unvTOZXAKfwy0iwP6uW9WFEr7yEW6MIfs8r2cAbw5J6QwokkSl huTsO/kyx6l62dV9+jHEHeL6hSHxHFCzTPWS6aOFNIM2kL941XSDOtolzUC4zVxvsuIkpOzwE zU3qYZm4HjYpDHgirPtLVxNtNyPppkuR43IrBn+Nr3EIC/YtdJcDwcs0B9iZPw9Hyt3SVikM8 +A0x51gb50Z6Bf3SRSJof85sjlGfPkHQBwaZiNPioHxzVITqBPcGbKeBWzORuEZj1KqOtuSPB jSWM+gU48wkstHvoIrLn/9QKKEU66k76xtfYO8yDzKwEZxKLn0jUaitj7NNrH2eW/+oWUQ1W1 bvgtMjEK/bIMtzKqNcul9euXLUgG0RvnwXKudV7QfkQZukN4YXRIjv52hoFBzxlrzl6JzVOqR KgwCsVRiNbgxMg6vk7NlzKSBXhc4luADcrlkorfG8T3zfqB3+XXrTd/tDrxtsh7I+F1/CdVQV NLq9lhzvLm9fVdwKH8l0bdsuNDgdNHzOaKtKam75lvzURDMFociCKxz+fKTYbq4jrjxJajTA0 kO7NpmoBcfiNBVXR3hjqtWztr3IU4k4LD4TKOGDmTIvK9C+Uc9QXHzrAW5GXvFZi8xwJBotYc mzeD5qfMNSZlI4qErtbYLKJG5lpSqKhH3tPuLCy5se4lmPmzAFryOi6b2OD9/ggDPyEfwPT6Z Yc8fTtaNLofjeLwYqPe/Z/AGs9OpBa/htBF0QcoiI9fyGhv0t2Je55mWTNlwb9QpW5uct/JM8 MLu07J0hPwWxFEwDdJuu1yKGWhlwGHbQZN8xqR388Y6QJUNKOIkyni3XOdrLmXnG7vYvcCOeW +EIf4gEG3fXyuR5d/s5ftMahNH7WysBHqGgBaKn2iWii1t4QaNTC+OpZy2XGLxD/lQhbSWaa/ fDsgft+HJFPxyA= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already nullifies the padding field of the passed serial_rs485 struct before returning it to userspace. Doing the same in the drivers rs485_config() function is redundant, so remove the concerning memset 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 Wed Feb 16 00:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543248 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21A22C4332F for ; Wed, 16 Feb 2022 00:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245017AbiBPATd (ORCPT ); Tue, 15 Feb 2022 19:19:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244978AbiBPATS (ORCPT ); Tue, 15 Feb 2022 19:19:18 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 223AEDD460; Tue, 15 Feb 2022 16:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970725; bh=p8QMhzf5BXOGOgdpvzQpYcOARim4oxi/fBzc9Njmipc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=CpVK4e7q8OypWMAKUrl1FHsiB2ucyfwSCBGbLCveYOvPBOtFsqNlO2ko3PRm1u+DC wKV5Yqo2CZMDS0BHUe+gF58uUsdbiwKrflMwOIIQjmQLbSPnmDFucjsaE0yad3gCXw JK5jdTSD/Vag8AO3jqSfeeMI99P52catderNOcFo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M7b6l-1nLXD617jZ-00835i; Wed, 16 Feb 2022 01:18:45 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 7/9] serial: imx: remove redundant assignment in rs485_config Date: Wed, 16 Feb 2022 01:18:01 +0100 Message-Id: <20220216001803.637-8-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ifqonzAg/uOEZqJ5tzZdRX/mbDQweIG/xNMJGv13ZEz4LKelJp+ AVB9rxaJPrOXTC8FQFCMiv0QNx479OQdXZgsHF7YJJKPGI/r+2TdRrQRigWD88Kw3dU7xdj l6uMtxsjlSdyxeYuZ3rj8e8mNAgCv7++KKHGEA7Nvu242Q0Qo0CmigcDtVpNXfWYMS2FTVM qGy32Szlz3qnmwh7Yt2xA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Ix5KGaxI8GU=:a/XP+OGQKZMZgoHSmS2tK2 t+rYXpeNE4KPdUsdhJv8p8uAS7531rSr768CYZl/9JAP9qwORBpzs3JDnDEYjpdPRENmJkatZ T+ZGFsjgkwlzcBSqNP2vftImjX8Go7Bm4SG48WBxK/XGzkCeFi/AskettlRfi/egXNIHQ9+c3 ZQDeyCsxVQAdCo1p5JvwnsOkgn/8/y1KsKcwmQ7luf22eByxSqqeUfxJmtYSMxT+6fDwuitJ8 nkDj4qRBtKRfldKmeS+7/1LWPX9IP0DebooSoqsaVvqIz03IXOiZEoGuBy5BSgNwHmA6ejLLk t1EWpWsnlQGxCgH87p50GT3Box/+e93jm3orusdfYooWzbcTOgGGgibsat2uldFMRTRiHD2pm eR1erqM086jSjDV3Qqsn0GtNU4fvGqZNl+WB82FjXHTtgwLfxZ1+NGjTdlJcix5yWAnDYVe6j gBL9ylRelbKA+wygM7L2D0cBGAmRlVL5DuOGVBzDhdXX8n4WU5OEcz5MbmTPG6mTN7LBOlVZJ 2T4dazfyfm8f9UPw1bPv0rgGsUSWUGCHS9yU+YN0RWT0xLYfb1EHjc6TuOJiueYQX0DWd1U0O GvYeXOqsG1y+RFg1C3TlDS2nhY9EfgEKihnFk6khx7Qr4gbQ8y55m7IMzrTWun/VQqkx0y+H/ huuvuAsDjQT+0NKnVNQUANCHib1c7cqClRkSEigEWk3F8dQiJgycbQ1wfEb8ms4wlWyxSY/5d RtJqor29Dqb+HUg9x8icqWd0sgN3OyJLMr/FrDI/JytHbQ1Qyi3klcT5f0Obpxr2NRKF0mZ2c PkDdIo+I1yClRGjRWNgS2BnYKhs9clvK9S1+dhRrkoNDNWDomsxATfPs2PVdbghFdEVqHuQYY xJ3G7KtV8/YRSS5cYEHuXuVQrMXFiZO/vQYC0rSaPvwu7yuUUtm2TNdv3dvPKi7vBaD/Fc8TX INak2TvnmG6D5KZdMi335mz6AeZ/yMVMGrr7dkh7VItPl3/HuLrzKH8BdKiYi7BWsVAjTT8Cf psbi0HqxkI8M+AKWtK3N7zcFDXn5Dhhl8kqxMzyhuJMFaGitvATK5C0M9NrRsMP+nSE+4mYTJ moOCkvYcTX4n08= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already assigns the passed serial_rs485 struct to the uart port. So remove the assignment in the drivers rs485_config() function to avoid reduncancy. Signed-off-by: Lino Sanfilippo Acked-by: Uwe Kleine-König --- 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 Wed Feb 16 00:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543247 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C0B1C433EF for ; Wed, 16 Feb 2022 00:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245022AbiBPATe (ORCPT ); Tue, 15 Feb 2022 19:19:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244853AbiBPATb (ORCPT ); Tue, 15 Feb 2022 19:19:31 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C97E2D4C84; Tue, 15 Feb 2022 16:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970726; bh=BQ5MyBCpjfg+yHv6OzKWHvUqGE9f+kW4GWjcO6Xbhrg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Dz12jh4ANy9mGmLaDvnvpB6Suvo2dMtVONY/FoEbGMR9Uzd3UGNJ0f/ySjBQMtfRT bKb5oX2Kodg4U/t8DEla21qObCRl3j2bqHL8KXVvzRWbLJM1hqZspDDGr7xm9a3TvM op7q34WgeNSbvFUUJAQQ7hUz7p1aeMQqT0Stnvfo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mk0JW-1o06c208y0-00kSRH; Wed, 16 Feb 2022 01:18:46 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Date: Wed, 16 Feb 2022 01:18:02 +0100 Message-Id: <20220216001803.637-9-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:P/8CsEWOtdAMBAgYCvJwzihfTUjSNmpksL/b7HGx4d+x+KZ+Aq5 GDe5r5fjAQPth1LWFk/RyKy+qtkIBQz/E2LHhpvHNpgkpJbIMQok+PDGFSINGISuUgutAS5 S0kOwaqwpPwogy0rb4nDgg/89JCHkCZs4YDbEDrHhvHwoQfSBnIghNqmTI7GlAQZTIBU1xe rV4ZGCdkwDmJR4ot70cnw== X-UI-Out-Filterresults: notjunk:1;V03:K0:52WexnfShw4=:drvjfqfunKYHM+fpCmKW8S K++lOUwYbzYVqR+mjmOneD5ojZwnaaaTmJ7KZGTKZPVyKW60Re7EQTKq5Sb2Ubpgc5JgOSFDP 4upLqhrTe0RS/bLjAEbXE11r0K6swVCxxvg0e2BaHNw38IVhbg2iWdiv/nCSeiETIdbWeqkmk o3qQogHTuR64jG+EaLAE9GcTQRn3M7QSTgVR7I9B6Z27EcCnXokiv4itGTJTlHUZa5uhLJuod 7LkKHIj5W0rfhkQgAaVpTIFzRJpB3ZdXjArDCDauMrM69WxeWEKA9bJsRUFPW/5s1g9z0LAut O6BYpPNQ987YzYnetcF067t20/2/BcMUebzRWS9NDyLmvyeEh0aMUrdgqQn7VT3/NpqVaC/fo npHK7EBQBpeOt/KToVMmBbzZTnKveUXp6M6H1ocH0B/9g3XCvN39IAhguG9LKIQKJUHrwf3M0 cwRaXRm2/GGWO0hO5rCVx7cruLaKh8ocTzyvKzEXCaj2C+9jBqL+H7gNbfLtGIyGoufw/Tr+p LrKg4H+Yls/MhjjabyflH9oZclYfGmLRFlhinblR8dTJC2RMOI28PXbe271mxhgU5MME4DdCH tG7tvJ3Rcd96edoNpGB8KS4jD3ZHm+nqh6D8yd2GOkNcLAIhV8uogsXe7DWfbFZaiOjZvv/EU zWZMyisGZIJLfHDkTGjnVR3NF6Zmp3fCzBrMoGRlIMLDmFUSoV00j6NXMffJp6JOfI4IefRnt UDz59onhesy9t7jFkbg7kGss5LCD9IN1DUgV05nMfcdPkCShizKYs9L+ARcxKxvKeEti4XUV/ 6luXNJjmtHlOWQzS6W+71Aa36hYDB/19EEzXlMOMO77oiEivC74/M7OeI/DdhgdjfkQHtTfla y+JPf5ochr/b8+sQx8IlNAIONuleXxmJB3qDi2z8xk9OfCB0djsDb58Q3N1zW0EMf1q1sPDTs Y4htZIssY9YnC5OH8Y4ybLDvfwWeIlMzAB9Iy+IOxrPwOC2lisZb9L1lHYAh2zMUiPa/BZbkx tswJfHhiKUaLSjRoCcXUYZAC6vDMnwaF0yZ388YwhJ6977YkBlhzjGliwd0XyBEVKyvdvPN3U m+oQDsS40NCVS8= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already ensures that only one of both options RTS on send or RTS after send is set. It also assigns the passed serial_rs485 struct to the uart port. So remove the check and the assignment from the drivers rs485_config() 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 Wed Feb 16 00:18:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 543667 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBDEBC433FE for ; Wed, 16 Feb 2022 00:19:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245025AbiBPATe (ORCPT ); Tue, 15 Feb 2022 19:19:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244992AbiBPATU (ORCPT ); Tue, 15 Feb 2022 19:19:20 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5EAB70332; Tue, 15 Feb 2022 16:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644970727; bh=7qzWDUNopK0bho5I5nYj0J78qRs15cAksVO/Q8GWxsw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=eFU5XYTy+SpZQMBcsDZPHFLFN/heaRrGD12W2PBjm6CRz7xdnfZoP8qKfzPPfmuOc 3+6+eam14QnT0azUMnqf/WBAcu7kQiwsONOTFuW/SMqfsadjkX9ieNX/FDot6bU4kA OfiAarqevJrMmzFMdzFEyCjsspbIhflL4hq93ViQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N6KYl-1oMKQo09Jx-016e1C; Wed, 16 Feb 2022 01:18:47 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Cc: linux@armlinux.org.uk, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 2 9/9] serial: atmel: remove redundant assignment in rs485_config Date: Wed, 16 Feb 2022 01:18:03 +0100 Message-Id: <20220216001803.637-10-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de> References: <20220216001803.637-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:zA2TdkclBElvUYZlMDu80hyoLmVC33BJetCeueVe0nw+noQF1V1 L/Ab3lZ4xwopWgLe/eddWpj7m2jLKl0mONq2uA12enhs6iQJxOtpVQrJETJo4TM51LKZ6c0 +Y+sXtpzeFP2FmWNq4E4DBv6OtQJnx4A4iFaBoQHkepgsEcvWh4VjPlJPmvVR2PxWjPRczs f23tAxie8X4MJm+pJhDow== X-UI-Out-Filterresults: notjunk:1;V03:K0:XcvYYdJUjWo=:atOtBcfRRm4xT8HMi31JHV MbZ0MzpH38gakA0WlwxC9/E+/3FI3Z+FityUADReFMjaq3vTJ9I2e1YOyQ8BildGgsuXd2PyZ +AvQxESyYnhUifIsSHX2MWHyJvtWL4WEkDD/KDeyaEIZjcP+hEk778pUGf1Nkrh1RTmzKKw1B Lr37gftv5eooYIwdiR1RQ9yon/wx7d7yYbgFqUTCLp3YN4VhrYgfj6lqgy7pCvhiLHdY30aRm Hm0bkWxevHH2BvoFXGlZ4XdpixJxqB5aWhNMnZel39s5RTkP57rO6vk2c4odwvOPFBN1LH0yQ vlGZGCNK0n4ZqP8T9PzGxdxGkBMHlfeMo8DuDmXCg0x76823YlQzeJ7UYl6CaLDpku7RKEgua zcODuEHFEw3EGfhqnazMtsONy0qbQ1S4Qchw/vV94NRDGQFYTooq8dwzCDUADHUu2K3PQzHPi X3jBGID2ilgamDREi+CNmK/QNlf0iRCcRf4n9eUNCsfkAFBzKjg53h3Sscd+CiyhLS9ZJUPPm HLg1eVHcdvC8RRzSRmF8mQC45aNo//ROuotXzo8XzYM3ebtn3wJ/qb9oLg2ZnbGM0nn5lKAwM JDTXzZgHHmNh1wT6mk39LGoUh5Q+WR9Oo4CWjkMt6Uh8leEOeyPVGTW8onq01k81gTx4rX0b1 /aSibjYS+4qMoptOh/CT/5h5zNmt33okgKLIkPJSWrD477+cU5X2JmvXj8vc9DDCVegtVTPG6 bPvAF7yy+GhSCr0HR8Jft0y2qu3tACB/Mvj6dOPzVm0dkLmu9YZJuUGsBePTOK8O/zL+xXaLV 4nQpcbEPrPai/j7QLPrQ3/urza7oqfCO1WEJ+1l+4VODlSk0VjMkbq2YvpfwAMrzs6k2eOYxP m9VAhPFJQASLD9792OlrxmOuVcDt73IjYVlxlRffIck/0fKnJ5FiozF46os6DBMTDXVlDrnNi BpbCJugA5GMy1hUwNtAaW6axViMSoDL8/TzxtgqZvxLvif6yTKj0jhC2Q4jyTfrty/siL099k CjFptrr3RbHdWUyu1uOgXqDEabjS0WNKBHkjoqzVhI9EDsVw5kp9FKIVtUBhGcqSqIBStgeyg QCIQxHcXHriSmE= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In uart_set_rs485_config() the serial core already assigns the passed serial_rs485 struct 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;