tty/serial: atmel: manage shutdown in case of RS485 or ISO7816 mode
authorNicolas Ferre <nicolas.ferre@microchip.com>
Mon, 10 Feb 2020 15:20:53 +0000 (16:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Feb 2020 20:26:44 +0000 (12:26 -0800)
In atmel_shutdown() we call atmel_stop_rx() and atmel_stop_tx() functions.
Prevent the rx restart that is implemented in RS485 or ISO7816 modes when
calling atmel_stop_tx() by using the atomic information tasklet_shutdown
that is already in place for this purpose.

Fixes: 98f2082c3ac4 ("tty/serial: atmel: enforce tasklet init and termination sequences")
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200210152053.8289-1-nicolas.ferre@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c

index c15c398c88a938bd49494f959a3cb8da5b983620..a39c87a7c2e180923ce54ff5a2b03f5c641e86f5 100644 (file)
@@ -570,7 +570,8 @@ static void atmel_stop_tx(struct uart_port *port)
        atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask);
 
        if (atmel_uart_is_half_duplex(port))
-               atmel_start_rx(port);
+               if (!atomic_read(&atmel_port->tasklet_shutdown))
+                       atmel_start_rx(port);
 
 }