serial: sprd: add locking for tx 04/135304/1 accepted/tizen/unified/20170622.105111 submit/tizen/20170622.031845
authorJoonyoung Shim <jy0922.shim@samsung.com>
Wed, 21 Jun 2017 05:03:29 +0000 (14:03 +0900)
committerJoonyoung Shim <jy0922.shim@samsung.com>
Wed, 21 Jun 2017 05:03:29 +0000 (14:03 +0900)
Sometimes booting time is delayed as waiting in tty for closing_wait
value when tty device is closed during do tx.

The tty driver requests to wakeup waiting process if pending tx data is
handled by tty driver, then above waiting should be stopped. BTW now
without stop, the waiting is kept until closing_wait value.

I'm not sure, but this problem seems be occured by processing about tx
data without any synchronization.

This patch adds locking for tx in sprd serial driver, then this problem
is gone.

Change-Id: Icb9d774c4d989c09b666be6951d01a820bb17be5
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
drivers/tty/serial/serial_sprd_dt.c

index ef43a1b..1c2c734 100755 (executable)
@@ -334,6 +334,7 @@ static inline void serial_sprd_tx_chars(int irq, void *dev_id)
 static irqreturn_t serial_sprd_interrupt_chars(int irq, void *dev_id)
 {
        struct uart_port *port = (struct uart_port *)dev_id;
+       unsigned long flags;
        u32 int_status;
 
        int_status = serial_in(port, ARM_UART_STS2);
@@ -346,7 +347,9 @@ static irqreturn_t serial_sprd_interrupt_chars(int irq, void *dev_id)
                serial_sprd_rx_chars(irq, port);
        }
        if (int_status & UART_STS_TX_FIFO_EMPTY) {
+               spin_lock_irqsave(&port->lock, flags);
                serial_sprd_tx_chars(irq, port);
+               spin_unlock_irqrestore(&port->lock, flags);
        }
 
        return IRQ_HANDLED;