]> git.karo-electronics.de Git - linux-beck.git/commitdiff
serial: stm32: fix spin_lock management
authorAlexandre TORGUE <alexandre.torgue@st.com>
Thu, 15 Sep 2016 16:42:41 +0000 (18:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Sep 2016 09:48:55 +0000 (11:48 +0200)
Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/stm32-usart.c

index 24c4d821472a71414e28e22704de1a1a40b4b2eb..3b99d790fb3fdba15d120f3791efd418691833d4 100644 (file)
@@ -321,6 +321,8 @@ static irqreturn_t stm32_interrupt(int irq, void *ptr)
        struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
        u32 sr;
 
+       spin_lock(&port->lock);
+
        sr = readl_relaxed(port->membase + ofs->isr);
 
        if ((sr & USART_SR_RXNE) && !(stm32_port->rx_ch))
@@ -329,6 +331,8 @@ static irqreturn_t stm32_interrupt(int irq, void *ptr)
        if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch))
                stm32_transmit_chars(port);
 
+       spin_unlock(&port->lock);
+
        if (stm32_port->rx_ch)
                return IRQ_WAKE_THREAD;
        else