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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <leonard.crestez@xxxxxxx>
Signed-off-by: Michael Walle <michael@xxxxxxxx>

Because the patch subject was renamed: This patch series is superseded
by the v2:
https://lore.kernel.org/linux-serial/20200325090658.25967-1-michael@xxxxxxxx/

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


---
 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;
 }



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux