On 12/27/22 15:56, Johan Hovold wrote:
[...]
@@ -793,27 +794,13 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr)
}
if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) {
- spin_lock(&port->lock);
+ spin_lock_irqsave(&port->lock, flags);
stm32_usart_transmit_chars(port);
- spin_unlock(&port->lock);
+ spin_unlock_irqrestore(&port->lock, flags);
This is not needed as the handler runs with interrupts disabled.
On SMP system, another thread on another core can call
stm32_usart_transmit_chars() . I don't think removing the locking is
correct ?
}
- if (stm32_usart_rx_dma_enabled(port))
- return IRQ_WAKE_THREAD;
- else
- return IRQ_HANDLED;
-}
-
-static irqreturn_t stm32_usart_threaded_interrupt(int irq, void *ptr)
-{
- struct uart_port *port = ptr;
- struct tty_port *tport = &port->state->port;
- struct stm32_port *stm32_port = to_stm32_port(port);
- unsigned int size;
- unsigned long flags;
-
/* Receiver timeout irq for DMA RX */
- if (!stm32_port->throttled) {
+ if (stm32_usart_rx_dma_enabled(port) && !stm32_port->throttled) {
spin_lock_irqsave(&port->lock, flags);
But you could change this to spin_lock() now.
[...]