Thread (19 messages) 19 messages, 3 authors, 2020-03-25

Re: [PATCH 1/3] tty: serial: fsl_lpuart: move dev_info_once()

From: Michael Walle <hidden>
Date: 2020-03-25 09:15:13
Also in: lkml

Am 2020-03-24 19:47, schrieb Michael Walle:
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 <redacted>
Signed-off-by: Michael Walle <redacted>
Because the patch subject was renamed: This patch series is superseded
by the v2:
  
https://lore.kernel.org/linux-serial/20200325090658.25967-1-michael@walle.cc/ (local)

I didn't include the 3/3 RFC patch though. This is a bigger change, 
which
should be carefully reviewed by the maintainer of the fsl_lpuart.c.

-michael

quoted hunk ↗ jump to hunk
---
 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;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help