Skip to content

Commit

Permalink
serial: uartps: Move the spinlock after the read of the tx empty
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Shubhrajyoti Datta authored and Greg Kroah-Hartman committed Jun 10, 2019
1 parent 1f74dfa commit 1074756
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/tty/serial/xilinx_uartps.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,6 @@ static void cdns_uart_set_termios(struct uart_port *port,
unsigned long flags;
unsigned int ctrl_reg, mode_reg;

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)) {
Expand All @@ -696,6 +694,7 @@ static void cdns_uart_set_termios(struct uart_port *port,
cpu_relax();
}
}
spin_lock_irqsave(&port->lock, flags);

/* Disable the TX and RX to set baud rate */
ctrl_reg = readl(port->membase + CDNS_UART_CR);
Expand Down

0 comments on commit 1074756

Please sign in to comment.