From patchwork Sun Feb 13 22:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 542478 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 A0FFAC433FE for ; Sun, 13 Feb 2022 22:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238638AbiBMWd5 (ORCPT ); Sun, 13 Feb 2022 17:33:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238628AbiBMWd4 (ORCPT ); Sun, 13 Feb 2022 17:33:56 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DA9954BC0; Sun, 13 Feb 2022 14:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644791628; bh=n1QSAdLWsAQBxZRJC/gnWpm6+lTx/Zgz/1kXnTeWbTk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Euvc0QJs5qieCLnv9C6/YUVPLjBNeYOTXTteefGmLXgCboPOrB8Nc0N2t5d99rahC sQi58eRP3vSQ7RSFe7zZLFnRDEJuGzgk5Onds7fSrTPgUV8Dj5anXTZYQPgtd16kQf 1bQUxA1+wejOhYged7FtqMi8wWKqNq+AzcsophYI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mk0NU-1nz4sc49Zg-00kOyf; Sun, 13 Feb 2022 23:28:11 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org 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 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Date: Sun, 13 Feb 2022 23:27:36 +0100 Message-Id: <20220213222737.15709-9-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220213222737.15709-1-LinoSanfilippo@gmx.de> References: <20220213222737.15709-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:C/eQLJontq2RLt02NobbFgS16JscCgWH9ptxRkHS5Z0m9OOZox8 QJGSADIVHCm1oXdpAIolH0IZm4dSg8gHv3aQgY5IRT0JMcQLYAzrw6FPiw1+XnQmDkw/xGA W1WYjAcv3FUh6R5QieabywvgR65jtD6wAJRB1A7LCgqcjvv7kUdIfMTyYwJm6rwuRAh/fiw 3G7H1DWGTLFL4eHAtVtHw== X-UI-Out-Filterresults: notjunk:1;V03:K0:U16uzVtWgXY=:tZVo3I7KjrLD55/IVEQz9A i0uiAt7g6CbjcxV7+YCGedN6AYeKUSm43jNjorEj8neySgcdg2sVwwxduc2CQQC70PmccQ5tq XrOW027kGd/ArvGgTfP6tgcddHDalQjca+c0/qe9SdRge7vq2sTvtBl6XrYXAD4+L361S+OfO rAAxjOb75fpa97uFUEzubcYPbPLH3MLqBR+n8ns0xJPGJHzugbHimrRC8vy3YxlumiJQ30j+d pIjoZjojcfUNkITgJJ21dm146N02KV7RwgnSROLHZ5jdsZRid1HKYYry+JvWhXGtKbrsYA7Ds E1aXunqXLQtroV/II3YKhT3DPvBVz/5VU6NT1CNIPoK2wMY2KRDlg2MIzKPr0rh+BMyiEDLPo E7D8I7POIZAj+N4/1NLTcBYr3QJ0zRDUmwLOhN4Q8+iMtsYzGcmEBi+kVepLJXYbowMTrdHzx xl3I2BCmGsMyW9iLeoQQYPOMDsdJmDOZ0TTZcLNYW3HTnX0H7KiwJoxqunqLnlR3z6tWS/VVo lRp7xMt+DqhD80CM2ga2SnUTwj03EVL40FwAlYzBJxFA4VcPhefsrI0Nq9rP1bTwkp6b7bHoj 7OjkX/pcn6/A8qphaA3jLWajFBLhAw+FivtuQl3aNjxW1NLRGE9QNCxl8n/eHwEm3av1i5rEv yBp01gmQMIH8erJH8PfN/9a+kkMsx3AHOpKmq5DKhNct+nyFdmPs5QJ0vwsHMuxSYp22hDWz4 rRnXE8gf7cfgOl1WNAXcUfjFPfJXev0K7WPKPB0UOGLUh7CFBV8QQ3TuYwYwRBJd+XbdtFxBz CmQo5IrTfu0aBLIm5KTgI3ZXmI5xjQeK8OPHp+Pj6tBN4g1Pg4qyu5BNJoNoZ2HMDxgRD/QwS IJU4wXn1V5tUjpxC/EtFLuTPvApg8swNJfKoIl8GDfVAGZidy6ZmlCWBaqftmBC6o5XSM8cwU ix3r4gTyaQ4kXmnFHcY7Pspvk9t7d4QSyXSvEI1gv29Vz0lijy0DWLnR0Y/SLaJOYv2NexX8r 1e0Wnraa0NTxvBYc5MsuzaJiMDQ/PCNr9sRuVidg8qGK3pt/gmlJwkclrDThrsoszVJINsdrW 3fHqSgh8a/wqHM= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org When RS485 is configured by userspace the serial core already checks for valid RTS settings and assigns the configuration to the uart port. So remove both tasks from the code of the lpuart_config_rs485 and the lpuart32_config_rs485 function to avoid redundancy. Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/fsl_lpuart.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 7d90c5a530ee..a201be44d68a 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1377,19 +1377,6 @@ static int lpuart_config_rs485(struct uart_port *port, /* Enable auto RS-485 RTS mode */ modem |= UARTMODEM_TXRTSE; - /* - * RTS needs to be logic HIGH either during transfer _or_ after - * transfer, other variants are not supported by the hardware. - */ - - if (!(rs485->flags & (SER_RS485_RTS_ON_SEND | - SER_RS485_RTS_AFTER_SEND))) - rs485->flags |= SER_RS485_RTS_ON_SEND; - - if (rs485->flags & SER_RS485_RTS_ON_SEND && - rs485->flags & SER_RS485_RTS_AFTER_SEND) - rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - /* * The hardware defaults to RTS logic HIGH while transfer. * Switch polarity in case RTS shall be logic HIGH @@ -1402,9 +1389,6 @@ static int lpuart_config_rs485(struct uart_port *port, modem |= UARTMODEM_TXRTSPOL; } - /* Store the new configuration */ - sport->port.rs485 = *rs485; - writeb(modem, sport->port.membase + UARTMODEM); return 0; } @@ -1428,19 +1412,6 @@ static int lpuart32_config_rs485(struct uart_port *port, /* Enable auto RS-485 RTS mode */ modem |= UARTMODEM_TXRTSE; - /* - * RTS needs to be logic HIGH either during transfer _or_ after - * transfer, other variants are not supported by the hardware. - */ - - if (!(rs485->flags & (SER_RS485_RTS_ON_SEND | - SER_RS485_RTS_AFTER_SEND))) - rs485->flags |= SER_RS485_RTS_ON_SEND; - - if (rs485->flags & SER_RS485_RTS_ON_SEND && - rs485->flags & SER_RS485_RTS_AFTER_SEND) - rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; - /* * The hardware defaults to RTS logic HIGH while transfer. * Switch polarity in case RTS shall be logic HIGH @@ -1453,9 +1424,6 @@ static int lpuart32_config_rs485(struct uart_port *port, modem |= UARTMODEM_TXRTSPOL; } - /* Store the new configuration */ - sport->port.rs485 = *rs485; - lpuart32_write(&sport->port, modem, UARTMODIR); return 0; }