From patchwork Sun Nov 19 16:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marion & Christophe JAILLET X-Patchwork-Id: 745334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D624C54E76 for ; Sun, 19 Nov 2023 16:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231372AbjKSQM7 (ORCPT ); Sun, 19 Nov 2023 11:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231384AbjKSQM6 (ORCPT ); Sun, 19 Nov 2023 11:12:58 -0500 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 127AE115 for ; Sun, 19 Nov 2023 08:12:53 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 4kPhraC9JxVPt4kPhrzakJ; Sun, 19 Nov 2023 17:12:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1700410371; bh=Cq+Ma44I5rcVPvAOPNh8K0fTdo2ud4VzNDLd8VR7lXI=; h=From:To:Cc:Subject:Date; b=ChbdukErzOOtfglZwCpdHBkaxrzADa93OvyXoTIXUi46MzloHVfMLE9En/DKorGUJ P67PUvUMGM2Tuxtf2ZASz8tK/Ha20efRoGORtHBBZhklDdIUkI80oBd/bEW+BYYg9W PGKQJBdN1GPrDtAaM78QjibbFvlRiI6FX7AWxIHUdDk6UTtvUmhzoOBmHv63yk3rnT Al4Uo4eCuAVvBlyUfbHLrIttdWucFsU0OYo3HETEMaekfESvUW/Ml+7at0b7oqvDk2 oR8S8nSLKLLDDddjpWPU3hP3mkp2wWbGxh4pfjCP1WDB7uFgfZWjSfbSrJkY0RQg8w QdkqQ9/u2in5A== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 19 Nov 2023 17:12:51 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] serial: imx: convert not to use dma_request_slave_channel() Date: Sun, 19 Nov 2023 17:12:48 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 --- 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(-) 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;