Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77bad0ab authored by Shubhrajyoti Datta's avatar Shubhrajyoti Datta Committed by Greg Kroah-Hartman
Browse files

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: default avatarShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: Pavel Machek <pavel@denx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2cdef3b4
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);