All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
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 <LinoSanfilippo@gmx.de>
Subject: [PATCH 2 5/9] serial: omap: remove redundant code in rs485_config
Date: Wed, 16 Feb 2022 01:17:59 +0100	[thread overview]
Message-ID: <20220216001803.637-6-LinoSanfilippo@gmx.de> (raw)
In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de>

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 <LinoSanfilippo@gmx.de>
---
 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);
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	u.kleine-koenig@pengutronix.de
Cc: linux-arm-kernel@lists.infradead.org,
	alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	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
Subject: [PATCH 2 5/9] serial: omap: remove redundant code in rs485_config
Date: Wed, 16 Feb 2022 01:17:59 +0100	[thread overview]
Message-ID: <20220216001803.637-6-LinoSanfilippo@gmx.de> (raw)
In-Reply-To: <20220216001803.637-1-LinoSanfilippo@gmx.de>

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 <LinoSanfilippo@gmx.de>
---
 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);
-- 
2.34.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-02-16  0:19 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16  0:17 Move RS485 implementation from drivers to serial core Lino Sanfilippo
2022-02-16  0:17 ` Lino Sanfilippo
2022-02-16  0:17 ` [PATCH 2 1/9] serial: core: move RS485 configuration tasks from drivers into core Lino Sanfilippo
2022-02-16  0:17   ` Lino Sanfilippo
2022-02-17 11:33   ` Lukas Wunner
2022-02-17 21:36     ` Lino Sanfilippo
2022-02-17 21:36       ` Lino Sanfilippo
2022-02-21 18:39   ` Greg KH
2022-02-21 18:39     ` Greg KH
2022-02-21 23:19     ` Lino Sanfilippo
2022-02-21 23:19       ` Lino Sanfilippo
2022-02-16  0:17 ` [PATCH 2 2/9] serial: amba-pl011: remove redundant code in rs485_config Lino Sanfilippo
2022-02-16  0:17   ` Lino Sanfilippo
2022-02-16  0:17 ` [PATCH 2 3/9] serial: stm32: " Lino Sanfilippo
2022-02-16  0:17   ` Lino Sanfilippo
2022-02-16  0:17 ` [PATCH 2 4/9] serial: sc16is7xx: remove redundant check " Lino Sanfilippo
2022-02-16  0:17   ` Lino Sanfilippo
2022-02-17 11:47   ` Lukas Wunner
2022-02-17 22:11     ` Lino Sanfilippo
2022-02-17 22:11       ` Lino Sanfilippo
2022-02-16  0:17 ` Lino Sanfilippo [this message]
2022-02-16  0:17   ` [PATCH 2 5/9] serial: omap: remove redundant code " Lino Sanfilippo
2022-02-16  0:18 ` [PATCH 2 6/9] serial: max310: remove redundant memset " Lino Sanfilippo
2022-02-16  0:18   ` Lino Sanfilippo
2022-02-16  0:18 ` [PATCH 2 7/9] serial: imx: remove redundant assignment " Lino Sanfilippo
2022-02-16  0:18   ` Lino Sanfilippo
2022-02-16 17:43   ` Uwe Kleine-König
2022-02-16 17:43     ` Uwe Kleine-König
2022-02-16  0:18 ` [PATCH 2 8/9] serial: fsl_lpuart: remove redundant code in rs485_config functions Lino Sanfilippo
2022-02-16  0:18   ` Lino Sanfilippo
2022-02-16  0:18 ` [PATCH 2 9/9] serial: atmel: remove redundant assignment in rs485_config Lino Sanfilippo
2022-02-16  0:18   ` Lino Sanfilippo
2022-02-17  9:22   ` Richard Genoud
2022-02-17  9:22     ` Richard Genoud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220216001803.637-6-LinoSanfilippo@gmx.de \
    --to=linosanfilippo@gmx.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=ludovic.desroches@microchip.com \
    --cc=lukas@wunner.de \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=richard.genoud@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.