Skip to content

Commit 2cbafff

Browse files
committed
Revert "serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler"
This reverts commit f24771b as it is reported to break the build. Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/202301200130.ttBiTzfO-lkp@intel.com Fixes: f24771b ("serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler") Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Valentin Caron <valentin.caron@foss.st.com> # V3 Cc: Marek Vasut <marex@denx.de> Cc: Johan Hovold <johan@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5342ab0 commit 2cbafff

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

drivers/tty/serial/stm32-usart.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,23 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr)
797797
spin_unlock(&port->lock);
798798
}
799799

800+
if (stm32_usart_rx_dma_enabled(port))
801+
return IRQ_WAKE_THREAD;
802+
else
803+
return IRQ_HANDLED;
804+
}
805+
806+
static irqreturn_t stm32_usart_threaded_interrupt(int irq, void *ptr)
807+
{
808+
struct uart_port *port = ptr;
809+
struct tty_port *tport = &port->state->port;
810+
struct stm32_port *stm32_port = to_stm32_port(port);
811+
unsigned int size;
812+
unsigned long flags;
813+
800814
/* Receiver timeout irq for DMA RX */
801-
if (stm32_usart_rx_dma_enabled(port) && !stm32_port->throttled) {
802-
spin_lock(&port->lock);
815+
if (!stm32_port->throttled) {
816+
spin_lock_irqsave(&port->lock, flags);
803817
size = stm32_usart_receive_chars(port, false);
804818
uart_unlock_and_check_sysrq_irqrestore(port, flags);
805819
if (size)
@@ -1001,8 +1015,10 @@ static int stm32_usart_startup(struct uart_port *port)
10011015
u32 val;
10021016
int ret;
10031017

1004-
ret = request_irq(port->irq, stm32_usart_interrupt,
1005-
IRQF_NO_SUSPEND, name, port);
1018+
ret = request_threaded_irq(port->irq, stm32_usart_interrupt,
1019+
stm32_usart_threaded_interrupt,
1020+
IRQF_ONESHOT | IRQF_NO_SUSPEND,
1021+
name, port);
10061022
if (ret)
10071023
return ret;
10081024

@@ -1585,6 +1601,13 @@ static int stm32_usart_of_dma_rx_probe(struct stm32_port *stm32port,
15851601
struct dma_slave_config config;
15861602
int ret;
15871603

1604+
/*
1605+
* Using DMA and threaded handler for the console could lead to
1606+
* deadlocks.
1607+
*/
1608+
if (uart_console(port))
1609+
return -ENODEV;
1610+
15881611
stm32port->rx_buf = dma_alloc_coherent(dev, RX_BUF_L,
15891612
&stm32port->rx_dma_buf,
15901613
GFP_KERNEL);

0 commit comments

Comments
 (0)