summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>2019-05-24 14:41:28 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-14 16:33:28 -0500
commit77bad0ab1b725e6c348277fcdb8790908286ca20 (patch)
tree7c73b315a1af2c9c5da2cad432c09ebb1072eea5
parent2cdef3b47a404cb913efb192f280673da6f6e227 (diff)
serial: uartps: Move the spinlock after the read of the tx empty
commit 107475685abfdee504bb0ef4824f15797f6d2d4d upstream. Currently we are doing a read of the status register. Move the spinlock after that as the reads need not be spinlock protected. This patch prevents relaxing the cpu with spinlock held. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Cc: Pavel Machek <pavel@denx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/xilinx_uartps.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 7cbee19ea93d..31950a38f0fb 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -686,8 +686,6 @@ static void cdns_uart_set_termios(struct uart_port *port,
unsigned int ctrl_reg, mode_reg, val;
int err;
- spin_lock_irqsave(&port->lock, flags);
-
/* Wait for the transmit FIFO to empty before making changes */
if (!(readl(port->membase + CDNS_UART_CR) &
CDNS_UART_CR_TX_DIS)) {
@@ -699,6 +697,7 @@ static void cdns_uart_set_termios(struct uart_port *port,
return;
}
}
+ spin_lock_irqsave(&port->lock, flags);
/* Disable the TX and RX to set baud rate */
ctrl_reg = readl(port->membase + CDNS_UART_CR);