diff mbox series

serial: imx: convert not to use dma_request_slave_channel()

Message ID a46b493c6b5cfa09417e3e138e304fd01b61e748.1700410346.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series serial: imx: convert not to use dma_request_slave_channel() | expand

Commit Message

Christophe JAILLET Nov. 19, 2023, 4:12 p.m. UTC
dma_request_slave_channel() is deprecated. dma_request_chan() should
be used directly instead.

Switch to the preferred function and update the error handling accordingly.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
I don't think that the:
   sport->dma_chan_xx = NULL;
are really needed. I added it just to make sure that the behavior was
exactly the same as before.

Anyway, it can't hurt.

Changing the returned value from -EINVAL to something else is fine. The
only caller on check if == 0 or not.
---
 drivers/tty/serial/imx.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Uwe Kleine-König Nov. 20, 2023, 7:25 a.m. UTC | #1
Hello Christophe,

I didn't look at the patch, but only noticed the Subject while browsing
my mail. In my (German) ear the sentence is broken. I'd do

	s/not to/to not/

(Not converting the driver could also be an empty patch :-)

Best regards
Uwe
Hugo Villeneuve Nov. 20, 2023, 3:12 p.m. UTC | #2
On Mon, 20 Nov 2023 08:25:17 +0100
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> Hello Christophe,
> 
> I didn't look at the patch, but only noticed the Subject while browsing
> my mail. In my (German) ear the sentence is broken. I'd do
> 
> 	s/not to/to not/
> 
> (Not converting the driver could also be an empty patch :-)

Hi,
I would suggest:

"serial: imx: replace deprecated dma_request_slave_channel()"

Hugo.
diff mbox series

Patch

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 708b9852a575..5cb74d8f9d2a 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1336,15 +1336,18 @@  static int imx_uart_dma_init(struct imx_port *sport)
 {
 	struct dma_slave_config slave_config = {};
 	struct device *dev = sport->port.dev;
+	struct dma_chan *chan;
 	int ret;
 
 	/* Prepare for RX : */
-	sport->dma_chan_rx = dma_request_slave_channel(dev, "rx");
-	if (!sport->dma_chan_rx) {
+	chan = dma_request_chan(dev, "rx");
+	if (IS_ERR(chan)) {
 		dev_dbg(dev, "cannot get the DMA channel.\n");
-		ret = -EINVAL;
+		sport->dma_chan_rx = NULL;
+		ret = PTR_ERR(chan);
 		goto err;
 	}
+	sport->dma_chan_rx = chan;
 
 	slave_config.direction = DMA_DEV_TO_MEM;
 	slave_config.src_addr = sport->port.mapbase + URXD0;
@@ -1366,12 +1369,14 @@  static int imx_uart_dma_init(struct imx_port *sport)
 	sport->rx_ring.buf = sport->rx_buf;
 
 	/* Prepare for TX : */
-	sport->dma_chan_tx = dma_request_slave_channel(dev, "tx");
-	if (!sport->dma_chan_tx) {
+	chan = dma_request_chan(dev, "tx");
+	if (IS_ERR(chan)) {
 		dev_err(dev, "cannot get the TX DMA channel!\n");
-		ret = -EINVAL;
+		sport->dma_chan_tx = NULL;
+		ret = PTR_ERR(chan);
 		goto err;
 	}
+	sport->dma_chan_tx = chan;
 
 	slave_config.direction = DMA_MEM_TO_DEV;
 	slave_config.dst_addr = sport->port.mapbase + URTX0;