From: Michael Walle <michael@walle.cc>
To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiri Slaby <jslaby@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Walle <michael@walle.cc>,
Leonard Crestez <leonard.crestez@nxp.com>
Subject: [PATCH 1/3] tty: serial: fsl_lpuart: move dev_info_once()
Date: Tue, 24 Mar 2020 19:47:56 +0100 [thread overview]
Message-ID: <20200324184758.8204-1-michael@walle.cc> (raw)
In-Reply-To: <VI1PR04MB69413E158203E33D42E3B3B3EEF10@VI1PR04MB6941.eurprd04.prod.outlook.com>
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@nxp.com>
Signed-off-by: Michael Walle <michael@walle.cc>
---
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;
}
--
2.20.1
next prev parent reply other threads:[~2020-03-24 18:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-06 21:44 [PATCH v4 0/4] tty: serial: fsl_lpuart: various fixes and LS1028A support Michael Walle
2020-03-06 21:44 ` [PATCH v4 1/4] tty: serial: fsl_lpuart: fix DMA operation when using IOMMU Michael Walle
2020-03-24 15:27 ` Leonard Crestez
2020-03-24 16:12 ` Andy Duan
2020-03-24 16:17 ` Michael Walle
2020-03-24 16:28 ` [EXT] " Andy Duan
2020-03-24 16:35 ` Michael Walle
2020-03-25 4:08 ` Andy Duan
2020-03-25 8:30 ` Michael Walle
2020-03-24 16:22 ` Michael Walle
2020-03-24 18:47 ` Michael Walle [this message]
2020-03-24 18:47 ` [PATCH 2/3] tty: serial: fsl_lpuart: fix return value checking Michael Walle
2020-03-24 18:47 ` [RFC PATCH 3/3] tty: serial: fsl_lpuart: fix possible console deadlock Michael Walle
2020-03-25 12:21 ` Leonard Crestez
2020-03-25 12:44 ` Michael Walle
2020-03-25 9:15 ` [PATCH 1/3] tty: serial: fsl_lpuart: move dev_info_once() Michael Walle
2020-03-06 21:44 ` [PATCH v4 2/4] tty: serial: fsl_lpuart: fix DMA mapping Michael Walle
2020-03-06 21:44 ` [PATCH v4 3/4] tty: serial: fsl_lpuart: add LS1028A support Michael Walle
2020-03-06 21:44 ` [PATCH v4 4/4] tty: serial: fsl_lpuart: add LS1028A earlycon support Michael Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200324184758.8204-1-michael@walle.cc \
--to=michael@walle.cc \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=leonard.crestez@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®