Re: [PATCHv2 1/2] serial: uartps: Move the spinlock after the read of the tx empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 21, 2019 at 04:35:26PM +0530, shubhrajyoti.datta@xxxxxxxxx wrote:
> From: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxxxxx>
> 
> Currently we are doing a read of the status register.
> Move the spinlock after that as the reads need not be spinlock
> protected.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxxxxx>
> ---
> 
>  drivers/tty/serial/xilinx_uartps.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> index 75e1027..8850790 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -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)) {
> @@ -700,6 +698,7 @@ static void cdns_uart_set_termios(struct uart_port *port,
>  			cpu_relax();
>  		}
>  	}
> +	spin_lock_irqsave(&port->lock, flags);

This is a bigger fix than you imply here, you should not be trying to
sleep with a spinlock held, which is what the current code does, right?

Please update the changelog to show what commit this fixes so it can be
properly backported to the needed stable kernels.

thanks,

greg k-h



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux