[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220213222737.15709-3-LinoSanfilippo@gmx.de>
Date: Sun, 13 Feb 2022 23:27:30 +0100
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: gregkh@...uxfoundation.org, jirislaby@...nel.org
Cc: linux@...linux.org.uk, richard.genoud@...il.com,
nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
ludovic.desroches@...rochip.com, shawnguo@...nel.org,
s.hauer@...gutronix.de, kernel@...gutronix.de, festevam@...il.com,
linux-imx@....com, mcoquelin.stm32@...il.com,
alexandre.torgue@...s.st.com, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com, lukas@...ner.de,
Lino Sanfilippo <LinoSanfilippo@....de>
Subject: [PATCH 2/9] serial: amba-pl011: remove redundant code in rs485_config
When RS485 is configured by userspace the serial core already
- checks for valid RTS settings
- nullifies the padding field of the passed serial_rs485 struct
- clamps the RTS delays
- assigns the passed configuration to the uart port struct
So remove these tasks from the code of the rs485_config function to avoid
redundancy.
Signed-off-by: Lino Sanfilippo <LinoSanfilippo@....de>
---
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;
--
2.34.1
Powered by blists - more mailing lists