From patchwork Tue Feb 22 01:14:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12754404 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 10101C433F5 for ; Tue, 22 Feb 2022 01:19:18 +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=4k/nFHbVLoCw42 aDBTOgJGF13i/ljzxGGYNGnuLzdUX1KwWx8nJGHQheF4K8VlsPZQ+cHip9GQMm7B0p6jjGz6FCI0J AFeOB2Q/eqX40rI6YuMYG3o96himzcSkgtWP0JMxEsEyWfOWNkNr5ODX+yvMzxcEG17bsSpM7JmXV pHRPoEKNgs1A7lfLG3JMVP+ey+9pjvyTRXa7KwOO9f+/wOL9Pg0zICa0EpqpLwBGvFXNOI3yr3cF/ PFWvQ8dcCrwZN+V5kcG2kzAqvUsTCoKTmOrZVtGuZNlCRhGESktE6ymulQfRZa8zE9Iai3vXr052O +UUmxf3bPMy2pzb/v0sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMJoG-007bIs-L7; Tue, 22 Feb 2022 01:17:45 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMJm9-007aP0-Mt for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 01:15:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645492512; bh=b2y7rSofyMsAlLxNarbQCRJjCqiYzdU9dmvDBfCGMLU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=HHyhmPBXip9YYtenzshreMUrlHEgCwgJ6wWiL/edeehDc1L9FOIWnsma8Bu6uZZyD WkEX/X87zgvOP77rTQKWAm3o7zDefUjJz8HnuJ/nD1rhqTix3XlYzHJDUMyJssIx/h nshou38+ERYs0+EqfKUkYzd49GigfpK6SX/dsj9Y= 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 1MysRk-1o9SNJ303m-00vtVm; Tue, 22 Feb 2022 02:15:11 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org, u.kleine-koenig@pengutronix.de Subject: [PATCH v3 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Date: Tue, 22 Feb 2022 02:14:32 +0100 Message-Id: <20220222011433.8761-9-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220222011433.8761-1-LinoSanfilippo@gmx.de> References: <20220222011433.8761-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:R0QwZ7CNF/l/mRVr+oYBpn8dTdTWnAg8vgoTGVXQ9Mtiola7ML7 Mkl6ZXbpw9nxjwQ/YrMsXG2eychqcNDicAHEe+IabnCRP/RAvPcJ62XIxtBfpGAF+em2sek kUgKE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HJyHpjAUuoKgLyCvAfmfpM1DvcYeQp9iiiL5UjW 4HXjKxQF84bIRqbZbg8XgLD1Dv1CHmH+LbIiDvYhdt1Urv1AUtUH0kyJHzCu1gUu3monwdCoj pyZqFbfcmYieAK4/7HVQFjGYri+JtV30JpBymfzWn98afpf1m3RtLuxJ22RQn6rRrGjmZ1B2Q st6kdOr4Wviz+I= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_171534_065338_16B72BB3 X-CRM114-Status: GOOD ( 11.45 ) 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; }