mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank.Li@oss.nxp.com
To: "Martin Povišer" <povik+lin@cutebit.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Shengjiu Wang" <shengjiu.wang@gmail.com>,
	"Xiubo Li" <Xiubo.Lee@gmail.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Nicolin Chen" <nicoleotsuka@gmail.com>,
	"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>, "Sen Wang" <sen@ti.com>
Cc: asahi@lists.linux.dev, linux-sound@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	 linux-renesas-soc@vger.kernel.org, imx@lists.linux.dev,
	vkoul@kernel.org,  Frank Li <Frank.Li@nxp.com>
Subject: [PATCH 4/4] ASoC: ti: davinci-mcasp: Use dmaengine_get_provider_device() API
Date: Fri, 06 Nov 2026 15:13:48 -0500	[thread overview]
Message-ID: <20261106-dma_sound_cleanup-v1-4-5eb8a7b81e87@nxp.com> (raw)
In-Reply-To: <20261106-dma_sound_cleanup-v1-0-5eb8a7b81e87@nxp.com>

From: Frank Li <Frank.Li@nxp.com>

Replace open-coded chan->device->dev with dmaengine_get_provider_device()
to avoid direct access to DMA engine internals. The WARN_ON check for
chan->device is no longer needed since already checked return value of
dma_request_chan(). It is impossible dma_chan is not NULL and DMA engine
device is NULL.

Prepare to make struct dma_device private.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 sound/soc/ti/davinci-mcasp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 481d1042ddb6d..e871925517dca 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -2477,6 +2477,7 @@ static const char *sdma_prefix = "ti,omap";
 static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
 {
 	struct dma_chan *chan;
+	struct device *dma_dev;
 	const char *tmp;
 	int ret = PCM_EDMA;
 
@@ -2488,13 +2489,10 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
 	if (IS_ERR(chan))
 		return dev_err_probe(mcasp->dev, PTR_ERR(chan),
 				     "Can't verify DMA configuration\n");
-	if (WARN_ON(!chan->device || !chan->device->dev)) {
-		dma_release_channel(chan);
-		return -EINVAL;
-	}
 
-	if (chan->device->dev->of_node)
-		ret = of_property_read_string(chan->device->dev->of_node,
+	dma_dev = dmaengine_get_provider_device(chan);
+	if (dma_dev->of_node)
+		ret = of_property_read_string(dma_dev->of_node,
 					      "compatible", &tmp);
 	else
 		dev_dbg(mcasp->dev, "DMA controller has no of-node\n");

-- 
2.43.0


      parent reply	other threads:[~2026-11-06 20:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 20:13 [PATCH 0/4] ASoC: Use dmaengine API instead of chan->device->dev Frank.Li
2026-11-06 20:13 ` [PATCH 1/4] ASoC: apple: mca: Use dmaengine_get_dma_device() " Frank.Li
2026-11-06 20:13 ` [PATCH 2/4] ASoC: fsl: asrc: Use dmaengine API " Frank.Li
2026-11-06 20:13 ` [PATCH 3/4] ASoC: renesas: rcar: Use dmaengine_get_dma_device() " Frank.Li
2026-11-06 20:13 ` Frank.Li [this message]

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=20261106-dma_sound_cleanup-v1-4-5eb8a7b81e87@nxp.com \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=asahi@lists.linux.dev \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=imx@lists.linux.dev \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=magnus.damm@gmail.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=perex@perex.cz \
    --cc=povik+lin@cutebit.org \
    --cc=sen@ti.com \
    --cc=shengjiu.wang@gmail.com \
    --cc=tiwai@suse.com \
    --cc=vkoul@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®