imx9/lpuart: Fix SMP deadlock with imx9_txint

A deadlock occurs for priv->lock when uart_xmitchars is called from
within imx9_txint. This is because uart_xmitchars does a callback to
imx9_txint and tries to acquire the lock again.

However, there is no reason to hold the lock over uart_xmitchars, as it
has its own lock for mutual exclusion. Only the UART device needs to
be protected, and priv->lock does that.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
This commit is contained in:
Ville Juven
2025-06-12 10:58:35 +03:00
committed by Alan C. Assis
parent c17f99438e
commit d8c907dfc7
+1 -2
View File
@@ -2358,6 +2358,7 @@ static void imx9_txint(struct uart_dev_s *dev, bool enable)
regval &= ~LPUART_ALL_INTS;
regval |= priv->ie;
imx9_serialout(priv, IMX9_LPUART_CTRL_OFFSET, regval);
spin_unlock_irqrestore(&priv->lock, flags);
#ifndef CONFIG_SUPPRESS_SERIAL_INTS
if (enable)
@@ -2365,8 +2366,6 @@ static void imx9_txint(struct uart_dev_s *dev, bool enable)
uart_xmitchars(dev);
}
#endif
spin_unlock_irqrestore(&priv->lock, flags);
}
#endif