Don't take the spinlock and use dev_info_once(). This may cause a hang
because the console takes this spinlock, too. Just print this info after
we've released the lock.
Fixes: 159381df1442f ("tty: serial: fsl_lpuart: fix DMA operation when
using IOMMU")
Reported-by: Leonard Crestez <leonard.crestez@xxxxxxx>
Signed-off-by: Michael Walle <michael@xxxxxxxx>
---
drivers/tty/serial/fsl_lpuart.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 9c6a018b1390..960fc2658f19 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1517,9 +1517,6 @@ static void lpuart_tx_dma_startup(struct
lpuart_port *sport)
sport->dma_tx_chan = dma_request_chan(sport->port.dev, "tx");
if (IS_ERR(sport->dma_tx_chan)) {
- dev_info_once(sport->port.dev,
- "DMA tx channel request failed, operating without tx DMA (%ld)\n",
- PTR_ERR(sport->dma_tx_chan));
sport->dma_tx_chan = NULL;
goto err;
}
@@ -1551,9 +1548,6 @@ static void lpuart_rx_dma_startup(struct
lpuart_port *sport)
sport->dma_rx_chan = dma_request_chan(sport->port.dev, "rx");
if (IS_ERR(sport->dma_rx_chan)) {
- dev_info_once(sport->port.dev,
- "DMA rx channel request failed, operating without rx DMA (%ld)\n",
- PTR_ERR(sport->dma_rx_chan));
sport->dma_rx_chan = NULL;
goto err;
}
@@ -1601,6 +1595,13 @@ static int lpuart_startup(struct uart_port *port)
spin_unlock_irqrestore(&sport->port.lock, flags);
+ if (!sport->dma_rx_chan)
+ dev_info_once(sport->port.dev,
+ "DMA rx channel request failed, operating without rx DMA\n");
+ if (!sport->dma_tx_chan)
+ dev_info_once(sport->port.dev,
+ "DMA tx channel request failed, operating without tx DMA\n");
+
return 0;
}
@@ -1653,13 +1654,20 @@ static int lpuart32_startup(struct uart_port *port)
lpuart32_setup_watermark_enable(sport);
-
lpuart_rx_dma_startup(sport);
lpuart_tx_dma_startup(sport);
lpuart32_configure(sport);
spin_unlock_irqrestore(&sport->port.lock, flags);
+
+ if (!sport->dma_rx_chan)
+ dev_info_once(sport->port.dev,
+ "DMA rx channel request failed, operating without rx DMA\n");
+ if (!sport->dma_tx_chan)
+ dev_info_once(sport->port.dev,
+ "DMA tx channel request failed, operating without tx DMA\n");
+
return 0;
}