From patchwork Mon Feb 28 02:39:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762323 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 E745DC433EF for ; Mon, 28 Feb 2022 02:43:14 +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=pV2HUc8e3jEmL2VqSdg/tMYjxLWcMfMn4r2hXdsIHWA=; b=fY2mH4tb5UU+2t fC10Bj3qVLL5p6E2dh1+RWGTGcr/Gc6Hc4LYelUC+nqfRUYrzE8qnweIihg/mCnHM2rRxd7GkI8oH yrj/gPdyFQxAYMn80duN+Vd1jX6X40rbCt6PASbxlsrQmJLQL0zx/429cTzdgIBPcZfsEXsisOy5q CiRYSyLOTb/JFFzUe7F+mxaUjanx0eSxQGCTvJ++zuKi9paI91TxjpOPOS+fP0/UYj96jlAGSX6lp PrcBPKcoE+cymEIhn29MlJLE+Oc76/Zm4sqfLJ4MJTSoOw73G06XVH2VB6RNHm8Kitt2QEiKmU2eW qFyAsAelf7+bALhipM9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVz1-00AZtE-Qi; Mon, 28 Feb 2022 02:41:56 +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 1nOVxK-00AZCz-63 for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015991; bh=s7PQLkyF7lgwD3XBQiSaqNoJa0DuoiTYpx9LJQP/Mls=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=cxpUscFLGUZJNcWt88FoOwBRPkoIN93GG0po2YwCVFNCRwfHt2GBaOum3BkF2QZYW ldIyQx9k8nFEALMlOWGIv631902+dQR4M46lVwG/+52ltRkBiS9LsEFMoWmJSYlJt2 eQgVFw1ngAqm2Sp03hXt4Trb1XrPfm5Ton43sq+M= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MpUUm-1nytxL1gXU-00ptLI; Mon, 28 Feb 2022 03:39:51 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 1/9] serial: core: move RS485 configuration tasks from drivers into core Date: Mon, 28 Feb 2022 03:39:20 +0100 Message-Id: <20220228023928.1067-2-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:YyRUGiMq45KbcRKKJ3U/JHT8I4NesVil7nhtV13/29TW+GJXRoX Pf/8SR9YukbA1QMs8UGUiOzhxfyOA+kAAwIoOhrF07ECYmOkfIoyaCtz/zfEzdBgPnZUv34 dVj5mtDXkQEbG/53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32e49NdiuXS0jL9dMiZgweh7VeJZnrANFFEZ6WS W2eM8wXk2Xpgbp3vz+4H3fUdmMR9pF+/7PNlzZrMnFlaZ4F2mUhDIuQE8k6+Ke1NWGCp1d80J i3igUQBF9hn8tv1wMOHQNezy0avDyrMlTnK5ymElvjPcaseOQyAWf1+q6jXeOM+yi+v7NI0nl w+ur/ENLj9LS9k= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184010_600652_5001661D X-CRM114-Status: GOOD ( 14.23 ) 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, p.rosenberger@kunbus.com 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 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 | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) base-commit: 71404f653cf7858fdbb81dd5419a8a4ac4ffa20c diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 846192a7b4bf..06eb3cfbe610 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -42,6 +42,11 @@ static struct lock_class_key port_lock_key; #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) +/* + * Max time with active RTS before/after data is sent. + */ +#define RS485_MAX_RTS_DELAY 100 /* msecs */ + static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, struct ktermios *old_termios); static void uart_wait_until_sent(struct tty_struct *tty, int timeout); @@ -1282,8 +1287,36 @@ 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)) { + dev_warn_ratelimited(port->dev, + "%s (%d): invalid RTS setting, using RTS_ON_SEND instead\n", + port->name, port->line); + rs485.flags |= SER_RS485_RTS_ON_SEND; + rs485.flags &= ~SER_RS485_RTS_AFTER_SEND; + } + + if (rs485.delay_rts_before_send > RS485_MAX_RTS_DELAY) { + rs485.delay_rts_before_send = RS485_MAX_RTS_DELAY; + dev_warn_ratelimited(port->dev, + "%s (%d): RTS delay before sending clamped to %u ms\n", + port->name, port->line, rs485.delay_rts_before_send); + } + + if (rs485.delay_rts_after_send > RS485_MAX_RTS_DELAY) { + rs485.delay_rts_after_send = RS485_MAX_RTS_DELAY; + dev_warn_ratelimited(port->dev, + "%s (%d): RTS delay after sending clamped to %u ms\n", + port->name, port->line, rs485.delay_rts_after_send); + } + /* 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; From patchwork Mon Feb 28 02:39:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762322 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 3E36CC433EF for ; Mon, 28 Feb 2022 02:42:57 +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=f+iI3tb1vjzrodn9AdqM1lVkZEDEcpOXUjE2jKAWSxs=; b=xdVN/FEPEDoQR6 dvYqGKyNBC3Z+K9H0zoYUQyDYx+o08r4nLGmVNeUwUDwBLkzKsS3uwaWoAQBhQnyLP2UsXzQR2TY2 D2HmnKlT1FKBvyHfQWlHlbnb5wtP7xL4tdDzYrC4cmYRMbXrme/ut08r8hyQkDrl7MIReU1n9tuII tKHGtRbZha8iZGsgVEO2QJLZNt5vdv10Oiqm0QOxFOW3XSJvSZb1WvxBQRk+WLjp8dudXXfpIPWH3 tYr0rjLblI0gMMc7/xMHT8Kke7n912sXtE6NceCuzmDi1Vgnt2WLDyxqNi9NMH7DsjyCS8bYGhwUM NLK3i2eJZteKSDeWZ6EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVyh-00AZlQ-Tc; Mon, 28 Feb 2022 02:41:36 +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 1nOVxL-00AZDY-LB for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015992; bh=KEo4sc077TnUumY/3jbiNcL70WXfdFpW/wOHZwtSo+c=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=U8CVLIYXiQfrqrF3Yjy3gpn+AQC6h/ZJaZXpURCtDMlv0KBmxLHwtcKmvzcXGV5hV 2pkN3IXlsTjoYCAhdygXc/xNawFZIWBuFadKOsOG/xBKU7fvAB5Ovgd4Uhesq12CoD PJ8L+cm8gO4UrISqst0Jo+UDBrdm9YohgxLPhzgY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M6DWi-1nHuEq0Vho-006cQK; Mon, 28 Feb 2022 03:39:52 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 2/9] serial: amba-pl011: remove redundant code in rs485_config Date: Mon, 28 Feb 2022 03:39:21 +0100 Message-Id: <20220228023928.1067-3-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:eg1D8cY8KvkEzDEdzcKaQNPZTMDNYQmE/sDotx9MDKb/I31DIL0 5CKcm4uTNggqI8C/ofN5Vew1u4vsHYN32jItoVnblyIFScaWN41z7y/v8WH4gqDk3bH5EEx J2G+EoxpAJ1kBGuF1nvCb/F9kG2+zGQWn6nTjHzWTZTFErY3dfhXr78tLI82jw6GrLsnLiT 7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7CBebq8nvkT96tzVyrCVsSHeCvps4On5yjkW+EOF84 ginoopQbntbPgGgQW5XQSCGmWmUD18dpgw6uZfBYXYLs9kHeMnkhrqS1HJGN09donLovKo3xU ZLMPaQbO9K9WLc= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184012_093181_F7E7B18E X-CRM114-Status: GOOD ( 12.58 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Mon Feb 28 02:39:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762320 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 8C1C9C433EF for ; Mon, 28 Feb 2022 02:41:58 +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=wq1Z44g4TA8Ji68D2/UuG8N/7/MFq8O9xufflTwot9o=; b=X9TNI2B106eQdT eHtlNrYRYinQfE2Vg9/6+Ug9kB2J8o40cZr2OuuBjgDSM7k/n53BLcjPAs0vdgqIRiYq/2FcdUrkK Byu7Cf+FAgqjLqvBMl/35m81RXCkGcPAAD0hON84jWJmbV3TcWIzuw3IM/PupnKxzuHRKMaoQDMxq HQl3/b0Cq4yL3VA4XxS3vMVFy6PYDrpV+mGB3hcGVeXDI6wVMdaVPZacXjQj56pD16MZEGgxo2+GW FFWWm/xTre/5YBa/tv/HC/9tYmPtMrZEBSqKPLJQqTVbyvWQBtdHZ3f/sniKh2pN7cCW3R4AcR3i2 1RJroOfsPDFa+xnz+gQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVxj-00AZPS-7C; Mon, 28 Feb 2022 02:40: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 1nOVxK-00AZDt-2e for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015993; bh=iPI9Eyd+3C6S85WoH/RH9YiOHOKEC2bR9K+d8H8925A=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=B2rz/X9piz6OIHopWLOnR1oRrBHZcoepl1hpJNpfcIm+OiUYTw6smz/pw8AB3R3/a r55CrB35v7qGgwzM5kYLiE1rHZxQea60z3wcibVZZ3LnzvtzuigJJDCWwCDOGLQ8LQ YSHdfcPMvqhgB8dKcOG5rvMJsaZIEFf+Kd8YvqXM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MBUqF-1nUoGl3ZVv-00CxpP; Mon, 28 Feb 2022 03:39:52 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 3/9] serial: stm32: remove redundant code in rs485_config Date: Mon, 28 Feb 2022 03:39:22 +0100 Message-Id: <20220228023928.1067-4-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Lr8oCML/RhTrktKji37TkXyhwoDx/xbf6v8vFT7o7L2qTyz8hit oKCSc08BFqYzX5GwZKq9lLExSpUiQhfFLT5EOci7KGo+LUkxPUou2t97Lv1wM3WcyyGZvfV l/91l524sXYL8NTToK57V4ZpiG2plg+RpFsv2TQmMnQi6N3Ot+Q8I8o2Pe+YMZCVCowIlkM Kv3+qEqAJvy4CY8Y4w5SQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:93hJ3foLheM=:31mi6t4gTO0FiQ+HU+tJpE Y5ApMv+V91qhpjpM8p6XwWY6rnTyF8EV/1mzKd2814MgpsFsif1pFJjKjFk+KkAJJAplpgBEp gZZiIlt4+XUnXvlPIsPJfBG8rE9fFnt7T98iXi/fu7ZXViWpjKcrCJN1FoEw9vBimsADRnYJQ LDUAZFYgwnD/ger09u29aj9vdDTDOrvmagFKVcVLuM/maf+V/dlbfaj2LtfNtl/OW1oOC4yhs 3JnhQuWhMXwMJx8OqGp1w3VoTeP/7gOAZx4FVr6vFLsAKW4rDVoOtOnbtxfu0ew7iHiWilZkZ hZvjVjNMnCi/ph2jpLFWfeLWdSzR/8eUvA9zd/f4xgaLY5BBFlC2fZZcPQlkIzbCAhKRAJFO8 BsLpkvz3riLcRvOaAANXNpm6yZl2kVyS/yRn+pdsamctncHw2XiPuUnXJ2yYqmTvASfM1oARN G747mNJGaZ1gk0LHh6qfEyCeO6V0kNfdyWbIxEoMji0XKGBUHf9VDO+X8tx9FIC9Wg8cjT6uY 04SQEdaBvFwlkKvpE1GiTFhSuxIpZAyeawhp9qblDu9BgxnbBTrKmUZQ3sI5wJ1j4HwtWSNPY 4qTdaWsqwWwfHf53lJ2Xtpkg/SwiOtrBPduNftDUrUBlicJOYS+cENHI0aLnnKW4O0vg5EfNO zbw7Fzvuqq5hDrWiHWugKULxY1p1AjxOcFefgZ3E8y5HJUGrHOORueTYV9HFGpFiOECNBmBx3 eHd2dqaMRv94ud9Nj16g26AqmOX4URVwKkdByV+ZT14Kw70V+AZamPfxx5zvaCTmCKAgn0Dqb KAAcaTrwxrNFg1BHB4BTBv7EeHLVWOtL8Ha+S9GYgjrg4z06ZwKklXkJKVAPiP7wE5juP2sOl bVcooI3JRAttvCFMfJKf0wlwXoL03kp4u2UMjWdVP/gHuKCxELS+XjB8OUtDZtP9eWWg3eISU M3xsOA9VELAYVOopFuLdXI+aCo7/qUmuDtUKBbIK8ZA8myTp/x9GeWw6YthWkjjqjTpMgxrE5 kOcaCVY2Cl4g5w0cODFb8K3oB2Dxk5yeq0g5J2/M6ibtuT8YGpku9IyAnP5AM8CYa+ZOSi38n dq7QFOS27y3MB8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184010_463326_37CA8586 X-CRM114-Status: GOOD ( 10.84 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Mon Feb 28 02:39:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762325 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 77624C433EF for ; Mon, 28 Feb 2022 02:44: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=gqnFbrsWpFwQg3JcmMKwvQlWt9yETzXD7WDAZHrDlJU=; b=RjeSLW7Ey4GDw6 cvMWt5PeADImoJcX2ZHg1sdCk/Tc+ZVDVTqMrUBXYgdDD2MeVvPqYamAW780lddCxGecet8thlF48 Y9ZNqW+FavYjCtZdR8+eBcCIb1r/DuatdSWrMblbGuP6GJSwMCnZLKNY5F5dzpPBi2qExY2vE3VRG cVPyWHBSZiZXksF4Mtb5aD/IopWqhd5Md99+W89Wy4z82kZNCTJzhKXP8ROudiDkT3CLmUmgfna4o cfH+ZyPXTh4/XPJ9Wa204nVy04fqk1+JQ9XyHcHcaEhnvpF1TKtcDRnuMH6hbwizHCu6S+i7Rl0EZ TBtZiWLyE/OaQcaklh+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVzy-00AaH4-RG; Mon, 28 Feb 2022 02:42: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 1nOVxL-00AZDV-LD for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015993; bh=TpdW3ujSzU0TXKj+hjSJqItA5IWaO0lajrfotqHvNTE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=SHDpFx/t87YD4N39Vn0qmonme2X2chHIAI7X3OefweS/IUkys5tCyBcHo7Td1Lv7v 8L+mKBznQMuaBoBuDtrf4Nuqxi5yDdtCt5jJgVYzMG9mWinpHOQbCBb/hEmb65u1xV jZ6CS6XQaXj7nlhKdn94u+MPeC3k9hRRsihy9jBM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mg6Zq-1nqglD2Osw-00hbbS; Mon, 28 Feb 2022 03:39:53 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 4/9] serial: sc16is7xx: remove redundant check in rs485_config Date: Mon, 28 Feb 2022 03:39:23 +0100 Message-Id: <20220228023928.1067-5-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:oSVWg5rBCqpWa6pMX1jUqajlxQKq82aAt/AFQNSu3Xr1YF5rLO9 gIRovRZ9arcEguHqRVmFa3sxRXd6jVcPN07+t4pnm2iAQK+CpO+iRq9oIssAlL98vv+w0Pa x0WkPFDbMq2uF4t1IG+E98MuZpzZJYyVNe1FdI38bQMUme4ePfskpdr9xmdBh3Z/S3kxt/Y A4UthJuyuD4JeA4DkJvWw== X-UI-Out-Filterresults: notjunk:1;V03:K0:46l4yZiWaho=:rgAJEltv7CEBl925Gvl0Ze 1Fq0F86+Azyy+VB5eCzIfVhub8QX2MJqWr/D2X5AXXjZkiLpn4FV1fnsr0pAv+yDc91HPl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.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184012_137653_5E0B1254 X-CRM114-Status: GOOD ( 10.04 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 b7a2db9c03e2..b4e66a322a58 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -983,16 +983,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 Mon Feb 28 02:39:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762321 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 DD505C433EF for ; Mon, 28 Feb 2022 02:42:31 +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=uurWa1vdylfIP9I7uCpY/Br70cwbSFyhag06/pY2Z4Q=; b=Dtu7st5SdawOeW qpgaInoRMKqf3X5ch0EVSkKDR1MF++6shoqym76yQjzu5PR3YATZNOtq0yAnA7VjJsN53VhwRtvp1 xhAQq5HLb6w3CJL+vi4QWgW+BfiQt/hIsstJ7mx2ZxZtOD17WtiH3VmTLlyeZMvafdOxnxaa3g2o5 v6BELduNXx8z2pZPfzlNLw8j7IwDcuZQfGLnoC1r4L9/tRHuZTOCDykHpOtoiTisnT5ys3Qv9qIyu 7vTKIh3XYkyQAQ6lmRBcro9flcaTjUUGlk1Z1XzoDVEwFoCy3u/bUYPUVDwhGjhv8Lvji95Cq89M8 9qOSRgBQV9lV2mGugAzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVyL-00AZeN-C1; Mon, 28 Feb 2022 02:41:13 +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 1nOVxK-00AZCt-5N for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015994; bh=Hex8IO2WpX9Y5fu2wHgqKu6/ZEI0eyXNRweluNBil8E=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=MJmRpAW3ELiY6xmT8V4KIe4FskOUjZzBMr+hm7/cHlIfvw81Qje3192nHowzBXVY9 b5CgdtlH859uTcoXNJ/GyzdvD+/VFlkaCMGoPJlMl8cLbAZMo6I6ICUHRKF0x7BuNn XXli6wwUkLOh7DPRPs9uvruS+/RBnJZ5xe20SR5A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MsHnm-1oDsRs1Bm6-00tkfi; Mon, 28 Feb 2022 03:39:54 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 5/9] serial: omap: remove redundant code in rs485_config Date: Mon, 28 Feb 2022 03:39:24 +0100 Message-Id: <20220228023928.1067-6-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:PzdDhAUBSdMJlshR3Bdzn7uubrZ2Nqrom7Xkdt+5MPDni17JylJ t3FciW6GtSjmf5Ut97Sks6n4utUOydeU7gnjx6v/Yak2RT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yTCkuYH7M9mRmKaSjm4ry+lvKOLk1xhQGQ8p5zb8Lm2WYYWlv7+bavO9rGj7w3yDq L1mlMH7iwaFJSl2McvA6CO7XvWz9Vdsr+rCecwWwXc3uH5OBdd45gTF0MeYytAcZNx6W++2rE 45WJ96obHqNSYRUWRd4B2gCgTXUs08KJgtq2Cm/ejUQU1A1bDpAcrEkA4jM4v491uREQcru4c 5BxKbNQwiaQta0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184010_549386_2DC8DBA5 X-CRM114-Status: GOOD ( 11.42 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 b4e060205e61..15ddaa1fdfa4 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1336,18 +1336,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); } @@ -1358,7 +1351,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 Mon Feb 28 02:39:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762327 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 35FDAC433F5 for ; Mon, 28 Feb 2022 02:45:34 +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=MTdCqq35HNPvW1/2epi+Lv07eohvCPprb3Ko1cc7GS0=; b=bamdLsrZ3EBUiv yfCTlyDEcy/zDQq3uUug/p6ULKUBfZomujO1oEDsyMA7pU54e+GopIpqZxknNhNDs3OeR1dnAoRsL aSHYJRu5iocaeG/mFefVN14fLgdxNoCnbgV6KiB7EqjWQ4lM3TiNGU7Yh0w18nkm/q/lJkyQzpEHU VmZm8XNuUIsau801Exjea6i35NuXQk3Y0Qz3MiEXuByzlmV3nlgAdLjk+BzqVuZBCu38JQmAayP3Z Wlr5ortR0ZYlvNCOOZL60pjP9CAhTT1e+W7KT27ZBtkE7pNFuJDBlUfWOPJMM03H8F3D2NqHeYSDs g8yRuJJEW59Qh+OYFflA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOW1C-00Aal6-6M; Mon, 28 Feb 2022 02:44:10 +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 1nOVxL-00AZE5-LF for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015995; bh=iSIbiqQY+am1M73zZEjjrGJSzNxevmnnhXm36hRIfqw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=f6CP4unmD1KZ6N3RFfl8UvbOK2ln9OziJUJ24F+mj9VZ9nCuIc8mraxGLehVELvKf yklplZE/IoQHmUEMq56NkwrbP+0C6ZhdyAVOdkUlLN7Bo6FFPyCuWr777QIomqSKuQ 6Rz5IoGASlXLfwJ/GyUcW+iZ2/XNOep/ky6pwQrk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M7sDq-1nKeKX020A-004yWo; Mon, 28 Feb 2022 03:39:55 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 6/9] serial: max310: remove redundant memset in rs485_config Date: Mon, 28 Feb 2022 03:39:25 +0100 Message-Id: <20220228023928.1067-7-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:UyxTOKZGWZ8nWvI2z/fzQ/YFBYocUp7YsypBgL9evAkOXKLDvLG jqIYO6zgCFPAOEYbCgIhAs3A3H7FnznWX/T/BescrY0+tQ3zgaJfbVj0wv+a3jJ7hUhmprd OD6EWw1ppf0YKRpLSfBN9X9yYNxjecYR2BAbmo2d5P4PnXyTsewWCoXpHXE4Hmts8sBD84q t4V4L9fgC5B8tfs42BLQg== X-UI-Out-Filterresults: notjunk:1;V03:K0:k2oBVy4zoV4=:mwK/Xpc21jlTi3xDXhNs2k eqhAzjMrEQaaTinvJFPpT8+PG3BscULCtOOD2Q46zirOe2wo6XfuQP61Xx3lktvHDMplBWKmA 89Bbigh9VGvMOLJPXZwGVJlXqKXIsewde0aglzDzEAvy+h2lic23Nzhjg8SlnLc/YScv5tjHz CcIzXvZ5wNWhnvNcyQIYCUL77vqCOWEIaQKruVurPFbxP7C5EiLXGMw67l4WvmEo2CavqZrjj 1EZT9gqxbYqfqPdGxxOydReXgJJWLLLiRGVpB3r2+PoWjVSqMINHCzbzNDtLMC5jfBJkgN0zs bgCh67fbI/DRI2oxV32dJgZoJiPzlikQcktPkNnaU9Zj6ivDQRn/VORadsjBnsXqI7jTx2jY6 4awBVAbJccqZm+Samr5Tloem4nb1ewNaO6enTJswzrAgETXv2sm0HZZAbLfX0EffpsDDlU2l3 yflCFuLpd/Y4Xo/0l1F5llnA2zcsTMwFxrgqfZCvnxPqE6hGQbAc4xZKvorbVfwnHwJwaH8GV Sl1mntBp+aZGwIDUTR3+tDkGGZKgZvLpI+cbmsKVHpBQh/tCC7HzkwyWd1ODVBGuWEC5ZpH5N GsbJfWP1agNrRoxSbF5HvcUggtS/cJjDE1AZQllBD4n7GHYRIFj1tLQYFW2oLwicJjx3Q7Gdp 7kLPRlqdFhivB4MbSTIYhMkE4gWdU7yINiWkIOxloQMIB7/d4nmLEnYdCsr9QN1CNX7VprmWi sTGYqnzfklFeqLedSZHOFF+A00A/W9q7UMvPizVDzAFmlcscKwSOlPrdzaGqpkmWYWuhgVwP0 ANcRRw8fc+a2961XI8CTc56EUo8SzP/VPGnSo68DhmuL8KyHzrgmBOcwVEKXP5jJ6WYnR8bMh oglr6yhgaAx/rIw95OddFzEgtMshc6O7lUdGBvZzQB9ieeKEEuqBH/OmBp/CxcY4NchZZSd/U R5ud+PnMUobadXESaVlN6VKbdEGFAMlVYvp4ejTpwGPkUuOvDDAMPnJN3lTie/QpfN0RMKPxa 3SssHCffvI+xYJOi6utjrhCMiPEKlRlLAyjq03DRf6WVS00OHS/NQRdXJEIbXuVI2M+P99dtV KWx/tkZ9TZjLXg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184012_134221_BB09D5AB X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Mon Feb 28 02:39:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762326 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 0E694C433EF for ; Mon, 28 Feb 2022 02:44:59 +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=dsf72w/lx5+pxXikyUJ719yafq6YHoofQVfOZv+7DHA=; b=Ku9aKIbJvJQIHn 05JqjKw6G+IgXTq/09VRojyAKRdY+nVlSr46uVnaCvg40bkxz9vUBR/6BU5Dl5dfqFwKqOlpmMiSd 1laTQ9sEUOQGYt8wQD4u+7iodVPxxKWEkxhRLfl74jVvJrXYHEJKWGTIhJukmXnPpV2+muoHWtsN9 cXpxYibfDjftly5Cj/W8IjJ8jtCk4QDQrGdV6a5q/G/N5Bxxwwrz2RcpkV1H72AdVVcalgkK6S1au ToHaRVWjkq1FMg0oWlxKEIf2H6IxJBfrAKVIZNADVY5vv1rrv7nqJ2hik3at0Jb0JVkZogY/b0eUt gXx3pVlYwOuSshA5RDaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOW0X-00AaVg-Ie; Mon, 28 Feb 2022 02:43:30 +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 1nOVxM-00AZDh-2K for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015995; bh=TjAcqoaAnmI0l2suIZ3fiCn2gdLnVgDyq5jYOOZmOWA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=egzCk6PLEW6jzuBH5Ay/BHf/YLpzdeNDLh12tM+XxnGLr1KoO/+ASW/ya15xBlwIk uK7QE0hBo6Ki0wopsnq2XbMBScFXdndYbFqvzeqUesmYtECIwaLH7blK4Fphd9Y5gD w+F0631x29u0i2hpiGW96sFF+/8GbhKlASgEj1/k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MRTRN-1navzq30QX-00NTW9; Mon, 28 Feb 2022 03:39:55 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 7/9] serial: imx: remove redundant assignment in rs485_config Date: Mon, 28 Feb 2022 03:39:26 +0100 Message-Id: <20220228023928.1067-8-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:OqeMSE2CDGXt5KJ7rWsD/nIkLMTCtETnI8mPAheao9RteHUJGjH uhUD9hHjzAgC5OkrDc4EyFM0mtAdCljBI8ScajPJ1tUtZ4fEtQR6l1gWFFN6dnRMb0kccMF GR8f+uhf6e+oXTukcckXjpiZRFG8gmLRl++cphp+zMyBSerp9tm06LJxhM3kM45hKwJDgw+ xW99kyvyOseDuWzuSDljg== X-UI-Out-Filterresults: notjunk:1;V03:K0:nyG/fLspJU8=:AYZg7QdM2fx5TjQNE4uplA ON0A/MUk4WKpoRdZVavvoFhzMeq4r9Fgp83P5TbqMSRS40Ul1qxFh8lHEZta/ylXkHQSQEI0n 4ohkZ7iB6uxSWHgWgpbNVkKUKuhYMykU57+DkyZOf75Fo6XUB1zmOfCB4J8NwQMQrNtlH0GcB KkeWcyQd04hmw81OYe1zjTQ48W1IR1x+/TwI8JveQFZBVZNBH8BQDUqEbV2/PIsYzR9c4MtgC J/DdVfd5nBvFehz4/2aiRmSU7L6U+ey8V+yZGzx1M/ca/Ns1TfSWQHwkrF+RLdb/WhUbhF57o ZNzS7SW9LZLrhegJO7xvLtyXok0XgwAty+ZzHySFeIeyNL0oBygKHzfwwni4Qhk5QO1lqEk9S xFYrAzIcmZJ6xMkupV43OECEuKDJDl/gcLkAVL/V0IQPrd/HRqeZGfVGcgG5nK1U3p7KEFvjn mfaYUeeXLs/8kvLiuAigW2Z0SGmvipR2g/xPC++De10+OoKyOMAYeOBNmce5e8j3Ep/6njUwr TMVntYKvHbXmBKZO7uJjS1gVE0DUYdsswNYSI9YXroQ8tkDXitRXw8Zu9BebganzvmGDfFvbI M9cSbKjBgnsE+Em5fw58IjJxqCyrmy/A4khElxmIHcbwLQHTLTsyZkDALPk9ya6j2TTzU5dZl 5rXKuQ0N7OYteVeVQ3usQtMSqL+DgkAwIr4n3SWzu4dkGzTPCNJGtTVroet5Awa+X0yKKqJCx GDQ3ks9NTEwmtsUAw5Eju6/bqQ53SDipx+KfjxCqCa6IP29tRImwHWTkiA9owpp2LwDJZuHgq UcjRPh0DZOhC832wOC/qzxBn2ejgbmmCfgvqf5UXENzfPw/b4e0DY6aNNLpCK0h41WXav/jSH opAUEv/HRD3f986FO4Gz1PDp5NVknqKIgUpwW1jJ9QwYpeJ3S0j4QHwmuruLnmSqkdbGI+TBs esIIwOp3QB2Dx6oxS+4IYgaRwDXbQE26AdE0EDLSHW1Z8/KXTkCwBneBvAvL1WMy58EQ5DXJt axykPGwCSZ+zTuhwQPfxkCYd2iGDtzJ2yFcdf1entYTBaSm1rImnribgQ2r14VbxTAkr07Bmi cZbfoChIBaGaUU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184012_471998_A8BF0A3C X-CRM114-Status: GOOD ( 10.74 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. Acked-by: Uwe Kleine-König 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 Mon Feb 28 02:39:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762319 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 D263EC433EF for ; Mon, 28 Feb 2022 02:41:36 +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=1zJOqyRR47Y7uuKy+hPXv2Dr0/h2p/xBdymlIfiqhxw=; b=aVEiTfUuyctFB3 BqI4bEbhvM5vM/UMB6RYQfQkqVXkiXsv/tXZBCRawcTJKYNAXItxGBGTSTcmjWItzM0+CR5Lyj5c4 UqAlnJhTOFOF/KVxaxYTxrBBj5Nqj8kq9DOw0zG0X2qTTM/R+JZgx3UJJ/jIkd6f1vXB9WboisqJR 8kT/GFQsE/nE5OqTd8PLQWlV1HSSV0i+ULfSi9+n4AwOsSK/p26mfWxU7FgHP0JlqB66yr7qEexiR ESo/hn3WylPInXgbKWUoS3ZcylmxHElh801R4x85EpV9qlhDanHXz/CpYQhV59L7P3QM8qy3/ZKFB IlSgGCEoDdXDWCsZq3fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVxQ-00AZI1-9M; Mon, 28 Feb 2022 02:40: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 1nOVxJ-00AZD1-PA for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015996; bh=b2y7rSofyMsAlLxNarbQCRJjCqiYzdU9dmvDBfCGMLU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=JR1AKVuNiqUbEUxyLsIzhssXF9U04iy6wbasXIWcmPYcWOwJvuupuX1uddFXeogpZ Igz8/9xLnDe0p0aWHdBknWFv+R6f5be4m8UZ3HGhaJF+F7oEyj2PmyvBaIS/3Y+4R6 FbdhhRQz9Q6v8Nl4MfPcx22jhW1XiIKwXCqnvXqM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MAfUe-1nV5W81iES-00B2Hg; Mon, 28 Feb 2022 03:39:56 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Date: Mon, 28 Feb 2022 03:39:27 +0100 Message-Id: <20220228023928.1067-9-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:XQdTAWN+hOCHQZI0v6PwJlCmNFGeLzfYONORxEzccuJo5JNkvy3 LLjpCfNjS+SyndZBa+MKsmY2KvbzaO3kciBZ+FYB2TZLsPwtWHz4At+PqEUr9rvE5H5xc2x nAmhN97jHyt9gP8kJvALdVh996IQr0+jGMGXgVrAInjtwCeZiEnMgx+jcWkfUn/luA1Ngyh h3KdHQN5wKUJuISgYfiDw== X-UI-Out-Filterresults: notjunk:1;V03:K0:xCK482DrRnc=:5lU9ulK8+36KTJoyzoD0vk +P/p+0PDYAbyZ4UQNvt/bpM/kJmxA4pYmDCK95qVXJork8vvYnw8ruFeweH/PvmGSaApDTHh1 Az/tVDrEz3Er3RB7OuOOUhFIshN/ZpgOzOgGxk90xI1QN4dWE+Cvd1y++v45p+K+t2YiDadCe LrBJSyV8XLDSccTCmIi18lU+li4jjZmNwFFuzYL1UUVwmrInpsMJmBE4plwYH3skq47e6ecQl 6XslkiKzE7Df6gZCvjZl1kpSMKw1Py3dok/l6GhXVEAnfwZUBYSE5nNKo30xlWF8PsePP+DwK Bb9T2nw+XlkBFsd+aq/px+FMFSLPXMIxBvuRHaSCb3ZGdeg2JJ3YFo8ilLx4qxjApztFPXCQz S4icdn1oHul70PywIAcElMwqf7f30Z5xo4TIF5B3a/ZbPEcbkUYr9h2ouR/hk8u0um5gOg/eu 2uIpWhmUGwkPeNUGgLP6lD5erLt/LvQgo0eLX8BxOv9uWG0atkB20J0Lz8U9Ly0SsFyBlBjWy dVR1NpmPqe97bOTayj8lAlVF8pASU+dddr9cp2PXbHzNRqkrA8WfaDeFCmuFsny5+ryG+G3DL FGVgCoqZm8y2o4ZK3R1ANcXVwcl79hwTNALkl8gMYMG5xJMn9idlCzEKBFaHNDB9ff4V6aUD4 sOQ2f7m85Da3+4itnf7ShvhQ6ct44UUYiiW3gHUF58i2VAP/nlBd8ayrFb1vb8u4lNC2gB3Zb eWzn44IBEKq4crDyf1CHMm7s0BcFE1mD1OSVXa/LlXRXj7TxMi67iheev4xrz/zeQHrMKaAGi 7CIJExyh9iwCI8DL3R+9+9F2qOiJx9TqWd7Pf5XbypfH2N1HpTQD1taLu4T92kXyjd5ZctcvG q93VbVjfUxgPHblv9p8hTlvUKwG1fHWmrUXyor05j/VuzBUxqUGI8Di2NkQ1Dz11wkXaCElqb syV/NuRUnFUnqvPrSG8/TMt5tAv7kv5ejJnerymMg0Xe6ntqCIRNk7sqg/6sFVNUbKwhV/De0 aQ6QSi2Xyt2t+5f1LgX/5n5kslu4LKcqCzuS1sGOK6B8rb7uZMu3IOwkTrJbKgkO1RzeHU7Fd jaO8BDIuDCxWc0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184010_167914_C686D4DD X-CRM114-Status: GOOD ( 11.00 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Mon Feb 28 02:39:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12762324 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 983C2C433F5 for ; Mon, 28 Feb 2022 02:43:34 +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=SgkIIAtWX3gOwBi6cNPwF7GQL8yV+mR5rW7cxzis/nY=; b=meJDnDzhT14sT3 Zk3rzJihrdJgI1DQJCgH6zzIdD8YtKMLz40q9PCzAUvwna65BH1nESktQUQRppFRBZH75HU/R3lia 0TyiViDcQTGtaFvUM+++l8oIpNMk3JYZO061UeufuHzJmt1p3IMN7rKZZjRctkQGGrTRLz75FKxx8 2uE8BH3F+6Y/X+3SB5jxLGF4Y4kD6pQf7O92xDr22v/Ye6rvi3UFpG0wugbYtNVeBrZCwDavEoxmE qR9pp74VOJzUNgBjemDXQHsfTvudgUohdUf5xYIDPizgT0kVgBmlfMlbJTknq5L05enHN9UVhwLuN c+tKPrsNPPU/FBXaUW2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOVzL-00Aa1H-Bv; Mon, 28 Feb 2022 02:42:15 +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 1nOVxL-00AZDO-LA for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 02:40:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646015997; bh=lEGAOtzgMEFzQKENfjNLVN0s0ToEzWqdhUuUbTO2bGM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=QLvB8/eHK+/SvsTwtT0eawHbDf2gnk1IMj5JWgZ+vCETZVKmKPM2nuJfdhBfSEZRu bRzvBLKTPZVNZVTLqV/IGZ6bzfPyV2SgNKo2gBSrnTeOeIdMP5ivp1byPVagCOKZ8S A6rVBx4fhRaGZ3u7xjM2cGODqJzdjYREc14QqDuk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mo6ux-1o0pd80Sst-00pbxb; Mon, 28 Feb 2022 03:39:57 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v4 9/9] serial: atmel: remove redundant assignment in rs485_config Date: Mon, 28 Feb 2022 03:39:28 +0100 Message-Id: <20220228023928.1067-10-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228023928.1067-1-LinoSanfilippo@gmx.de> References: <20220228023928.1067-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:YV4KYBkt5vzMrAX6xWwquDgNmwuBCgeR6qBMGU7OtpSXlhEZBgV hsctjceCxGWP8JlM7yusdI+xE38Ji9hhrArnUSILM6GzTNnW/S6iSXrTnTqyfdqwKRI1lv5 G2rO+BDEbqb1V+s8OguTgqmQ40B1DtCvgIjOo17IFLvGAVwD0HUu4DPGrNPkSdrZ0azh2T7 1GtHBqoFveUeOa9p2lVJw== X-UI-Out-Filterresults: notjunk:1;V03:K0:h4UaHU7djQk=:7t0EOHwetVvLoSDwyT7kQP 5ypQC6G1iU+SvNNR2VaSPgp9T0yrtmocNDX/1Ud/Qz9+tFSaoQkGJ1NELIRvmJoMXakodYOZ0 eb3IdiMM+cjtSqr8d1bYBBt4tDgetKjfLhbIAIRH7qAco4QYFadummZjZtjUSCRvpuvyGN7y3 3GIxDs7tXEBPFzrLOcjJPX0qqox1omm9eByXUKifeBb/U44RhCg/jn+sIKPzfzvt6jasXJPW7 RWlzOErH/JJ9/nlbakntOHw/UoLse7D30NHkVsDrhL9rM1WY72B3nP2VBSr0WsckTP2+JxHUk kNddDvMhfU9oIKaZjQCa8eyZNyMPajPNKWHtYaaHmol7byZ8rwagKQq10Q8+ahdJPTRXAsSq+ 7ZuotDHY9eOB/hcnrwrdk5rx8HLFDPF2qQcAtj41AOdum2cWTApdITbgXY2Ivtff3cTkz0DEU DYuzpYWeMKarqjme48FqRuZ60Gk80qN/r9YjFOVOux/OLTIfDWxqBZcDwpX6ZPzvFILkhdE05 oHia0+xtN9CTrj+Q7UItQHRfQsXfFG90aooHaQzVniAK9LeUTC/+DL0z5sWbFhUe8/zeeNHD6 L8ToIX8Z7UTqiWzbWvkrVZhtl8GEuqJWb2JXzLFSbo9CqFUZuqgVEZ3Kn79pC8ETyApVuGxmA T4HAgYu86TGI0ufinZAjKRMRRS9kzeAJBRd8YNyrTpmLbnkh3eSNBwJ8qxtbgcQv1NNRtPAmg k8nSng1DKhTJFDuSW3PHhsMA0CGiIiXkqxYHKTgGHf3gLvAbV+tk5mregVGHVCDE/6TBC8vwc N9cVHsdOnJUR4D4xqb+rtPTRvRUQ6gq0zXsJumebwEZOpW7HbczSQRMh/p6dweI7rDWX5zHMa UCPNi0ap8fCExByFvY6qpUwTSAsdMkPuoOJpxo239wln9qau1TE1NOX3zwh87AvnK9GEkUuxA CXz+tq+pn48xPThCwFUZnTJ8sojmmJURtPDFUlNeY9sOhgzoJOs1SBRNrhf5JDJgjPTjvHMtc B23hTJ/kucecTA5bCBDHjidOzD+w31Yz+HU6ub8sWdwpj0DeJhLEegLi9xYbQ+GhhTINAxTfC zFbNjUzFRJekGI= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_184012_075046_28078DD7 X-CRM114-Status: GOOD ( 10.54 ) 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, p.rosenberger@kunbus.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. Acked-by: Richard Genoud 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 73d43919898d..18d3bbdcb7a2 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;