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: Michal Simek <michal.simek@xilinx.com>
  • Loading branch information
Shubhrajyoti Datta authored and Michal Simek committed Jun 10, 2019
1 parent ec432d9 commit 5d5946e
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 @@ -690,8 +690,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 @@ -700,6 +698,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 5d5946e

Please sign in to comment.