1 From 2cbafffbf69addd7509072f4be5917f81d238cf6 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Fri, 20 Jan 2023 11:16:59 +0100
4 Subject: Revert "serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler"
6 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 commit 2cbafffbf69addd7509072f4be5917f81d238cf6 upstream.
10 This reverts commit f24771b62a83239f0dce816bddf0f6807f436235 as it is
11 reported to break the build.
13 Reported-by: kernel test robot <lkp@intel.com>
14 Link: https://lore.kernel.org/r/202301200130.ttBiTzfO-lkp@intel.com
15 Fixes: f24771b62a83 ("serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler")
16 Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
17 Cc: Valentin Caron <valentin.caron@foss.st.com> # V3
18 Cc: Marek Vasut <marex@denx.de>
19 Cc: Johan Hovold <johan@kernel.org>
20 Cc: stable@vger.kernel.org
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 drivers/tty/serial/stm32-usart.c | 31 +++++++++++++++++++++++++++----
24 1 file changed, 27 insertions(+), 4 deletions(-)
26 --- a/drivers/tty/serial/stm32-usart.c
27 +++ b/drivers/tty/serial/stm32-usart.c
28 @@ -798,9 +798,23 @@ static irqreturn_t stm32_usart_interrupt
29 spin_unlock(&port->lock);
32 + if (stm32_usart_rx_dma_enabled(port))
33 + return IRQ_WAKE_THREAD;
38 +static irqreturn_t stm32_usart_threaded_interrupt(int irq, void *ptr)
40 + struct uart_port *port = ptr;
41 + struct tty_port *tport = &port->state->port;
42 + struct stm32_port *stm32_port = to_stm32_port(port);
44 + unsigned long flags;
46 /* Receiver timeout irq for DMA RX */
47 - if (stm32_usart_rx_dma_enabled(port) && !stm32_port->throttled) {
48 - spin_lock(&port->lock);
49 + if (!stm32_port->throttled) {
50 + spin_lock_irqsave(&port->lock, flags);
51 size = stm32_usart_receive_chars(port, false);
52 uart_unlock_and_check_sysrq_irqrestore(port, flags);
54 @@ -1002,8 +1016,10 @@ static int stm32_usart_startup(struct ua
58 - ret = request_irq(port->irq, stm32_usart_interrupt,
59 - IRQF_NO_SUSPEND, name, port);
60 + ret = request_threaded_irq(port->irq, stm32_usart_interrupt,
61 + stm32_usart_threaded_interrupt,
62 + IRQF_ONESHOT | IRQF_NO_SUSPEND,
67 @@ -1586,6 +1602,13 @@ static int stm32_usart_of_dma_rx_probe(s
68 struct dma_slave_config config;
72 + * Using DMA and threaded handler for the console could lead to
75 + if (uart_console(port))
78 stm32port->rx_buf = dma_alloc_coherent(dev, RX_BUF_L,
79 &stm32port->rx_dma_buf,