From patchwork Tue Feb 22 01:14:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 546139 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 66111C433F5 for ; Tue, 22 Feb 2022 01:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238114AbiBVBQF (ORCPT ); Mon, 21 Feb 2022 20:16:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234799AbiBVBQC (ORCPT ); Mon, 21 Feb 2022 20:16:02 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 218DD24F2A; Mon, 21 Feb 2022 17:15:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645492510; bh=eHlPTyV9IH6b1xICykBM6gHlY+Gr9tRTW5duy1JBpCA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=eQUngbgwLqLUom8dFWlKScyPSsPcRzNhp2S1l8mr9vwx/IRfkkEPGb3djUohUAC1f l5ny3hweItnNF6kAMqIOdzzTjmarP54tzL1BNNYemiqqVcUeAJQzRDPU5SIPuXWyys SczksCEqxNegmyJ7hjfVOzVPNdeRM28EH9H9bvWQ= 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 1MmlT2-1o3sKZ3XoU-00jv50; Tue, 22 Feb 2022 02:15:09 +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, p.rosenberger@kunbus.com, Lino Sanfilippo Subject: [PATCH v3 5/9] serial: omap: remove redundant code in rs485_config Date: Tue, 22 Feb 2022 02:14:29 +0100 Message-Id: <20220222011433.8761-6-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:jbVz0BNPswbOMgeN+DDhwoQBpe2I7vCkKwtO+bMQdX/FHpjcwnH 8mmQEiIsth6jNfR/2SLrMzcaYcWspkmia3HWTqVqCzTIDvE6DLoU2DJS2lwhAeuM4TVnAhw zYpKLPMqM+8TdUXBFfI0fcvgqHx2P5E4tA0/ZRMQvsDikWF+zXfKRqAirrwrgk56ReyTgwP p3+8aUY1VyqdappZfGP8Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:DSOyH+r7gr8=:rgl6X+KkNVZhXNpOmDfJK7 77m3/RGNqTQBAkrsUab0Fz0lqJyPVwXHNlJ1Z39QREf8VuiS/WQN6dy6lQZYyJzG9I2r4xNs/ FOqOk/inE9zm9UssXDFZX3P6AtG1lItZ90QlddRuQ7QZ89ugcEgewtjXt1smPQgiqgSt9RtSj 0evq61hHN/iUTjHY9Q4p83XzDlxxs2htazuSdXOd80f35n0MyZ9DHtA1iXtT3gqC/o1kxvlZw vT2OJej7bgYIkWcubky3LjkaF8Bx67hdvhwVcTXckOGOxa0UUeAP1Cpl23XwllBhhIlioldVQ MA7GfKdZNE7cAfGLDmqdFOboygTZW0T47Ru5zPiIRyahfYFpGT7PDOVD4hyZjldTtpgJm2ohx brc0KEa/Shz9H/fg8TsR1klRsJ7d/ElkL2dNWcGWljEQKB1gnGy5sqyun8f/2qj8Zr4Enm+1S jyAb+eUp4SzVFhGPj8qq+LUAHth5ZOmpAPHYr93ObhgBLp4HohpYHHZSCLAcyy+MLccru6rKx W3P1X3Ctv0HPli9zNRABgW//IN+hIOzdvnc7D48d2rxOdqLuUP/H8Iq9y1YJluzFxCkPxLEtZ Vmf42iiSf0lZbWlaL3ppsaPqpMjDd5Dk3Q7gk8sAnyb0Lulr7ZF06MPNYgqmD+p9n99aYwzO0 iKmwfQ8ABvYXtz+jbsbsedurmLMoSpTW4Cp1Ie3aW4mbX5wSIBN5+NLbE4UK2ujQup7AKEGs0 8z2Gpbju4XX27Mq46wgeO587ryrX2MdbUtKBmvJBvxHhcKKlrfX1iT9YlZfPrNG/ZMwehta0v +4WTsbniX4j+I2P2CpV2jWL3zu0ie0sLg0EZNw67NPy2zUywJ50G4Fujtm8K8IrCeUM22PJ22 A7gUzNU8uPeboGsq/NebpEEzpKyx6v0SX10X+wKZ0YSuUyCH2N6Nmf+ToFrTWQTgI1RBhGKOp YFaB/r7oEM/Ylo0VUMmVBwdAiQBUjocarplDuBPwaB1yA9wpmVX6ZeG5HBNZrScwlvUZuIRKX U+EhKOdxP71r/3im1hNFIlgfRuvZRCzfa2gir0nmFpDgppqldW3qhWOqW740Gnn4oSiAXi49b W24XQav1t/0uRs= 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);