serial: omap: remove redundant code in rs485_config
authorLino Sanfilippo <LinoSanfilippo@gmx.de>
Sun, 10 Apr 2022 10:46:38 +0000 (12:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 09:30:22 +0000 (11:30 +0200)
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>
Link: https://lore.kernel.org/r/20220410104642.32195-6-LinoSanfilippo@gmx.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/omap-serial.c

index 8d5ffa196097eb7ed95dc264654ac3d223c1f375..46f4d4cacb6e38d663c68bc75630f5d80cf6edcc 100644 (file)
@@ -1336,18 +1336,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);
        }
 
@@ -1358,7 +1351,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);