From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre TORGUE Subject: [PATCH 09/11] serial: stm32: fix spin_lock management Date: Thu, 15 Sep 2016 18:42:41 +0200 Message-ID: <1473957763-30629-10-git-send-email-alexandre.torgue@st.com> References: <1473957763-30629-1-git-send-email-alexandre.torgue@st.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1473957763-30629-1-git-send-email-alexandre.torgue-qxv4g6HH51o@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Maxime Coquelin , Rob Herring , gerald.baeza-qxv4g6HH51o@public.gmane.org, Greg Kroah-Hartman , Jiri Slaby Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-serial@vger.kernel.org Signed-off-by: Gerald Baeza Signed-off-by: Alexandre TORGUE diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 24c4d82..3b99d79 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -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 -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html