From: Frank.Li@oss.nxp.com
To: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Andi Shyti" <andi.shyti@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Philipp Stanner" <phasta@kernel.org>,
linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR I2C
DRIVERS),
linux-i2c@vger.kernel.org (open list:I2C SUBSYSTEM HOST DRIVERS),
linux-kernel@vger.kernel.org (open list),
linux-media@vger.kernel.org (open list:DMA BUFFER SHARING
FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b),
dri-devel@lists.freedesktop.org (open list:DMA BUFFER SHARING
FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b),
linaro-mm-sig@lists.linaro.org (moderated list:DMA BUFFER
SHARING FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b)
Cc: imx@lists.linux.dev, vkoul@kernel.org, Frank Li <Frank.Li@nxp.com>
Subject: [PATCH 1/1] i2c: use dmaengine_get_dma_device() instead of chan->device->dev
Date: Tue, 3 Nov 2026 16:26:54 -0500 [thread overview]
Message-ID: <20261103212655.1774644-1-Frank.Li@oss.nxp.com> (raw)
From: Frank Li <Frank.Li@nxp.com>
Replace direct dma_chan::device::dev access with the proper
dmaengine_get_dma_device() for consumer API.
chan->device->dev is not always the device used for DMA mapping. Some DMA
engines support per-channel IOMMU mappings, so different channels may use
different DMA devices. dmaengine_get_dma_device() returns the correct
device for each channel.
This also prepares for making the DMA engine provider data structures
private. DMA consumers should not access DMA engine internals directly.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/i2c/busses/i2c-rcar.c | 6 +++---
drivers/i2c/busses/i2c-sh_mobile.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 755064804cb21..86b1df3a56c4d 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -455,7 +455,7 @@ static void rcar_i2c_cleanup_dma(struct rcar_i2c_priv *priv, bool terminate)
if (terminate)
dmaengine_terminate_sync(chan);
- dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg),
+ dma_unmap_single(dmaengine_get_dma_device(chan), sg_dma_address(&priv->sg),
sg_dma_len(&priv->sg), priv->dma_direction);
/* Gen3+ can only do one RXDMA per transfer and we just completed it */
@@ -511,8 +511,8 @@ static bool rcar_i2c_dma(struct rcar_i2c_priv *priv)
len = priv->msg->len - 1;
}
- dma_addr = dma_map_single(chan->device->dev, buf, len, dir);
- if (dma_mapping_error(chan->device->dev, dma_addr)) {
+ dma_addr = dma_map_single(dmaengine_get_dma_device(chan), buf, len, dir);
+ if (dma_mapping_error(dmaengine_get_dma_device(chan), dma_addr)) {
dev_dbg(dev, "dma map failed, using PIO\n");
return false;
}
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 3a55f803e4f15..023813c2f7809 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -452,7 +452,7 @@ static void sh_mobile_i2c_cleanup_dma(struct sh_mobile_i2c_data *pd, bool termin
if (terminate)
dmaengine_terminate_sync(chan);
- dma_unmap_single(chan->device->dev, sg_dma_address(&pd->sg),
+ dma_unmap_single(dmaengine_get_dma_device(chan), sg_dma_address(&pd->sg),
pd->msg->len, pd->dma_direction);
pd->dma_direction = DMA_NONE;
@@ -526,8 +526,8 @@ static void sh_mobile_i2c_xfer_dma(struct sh_mobile_i2c_data *pd)
if (IS_ERR(chan))
return;
- dma_addr = dma_map_single(chan->device->dev, pd->dma_buf, pd->msg->len, dir);
- if (dma_mapping_error(chan->device->dev, dma_addr)) {
+ dma_addr = dma_map_single(dmaengine_get_dma_device(chan), pd->dma_buf, pd->msg->len, dir);
+ if (dma_mapping_error(dmaengine_get_dma_device(chan), dma_addr)) {
dev_dbg(pd->dev, "dma map failed, using PIO\n");
return;
}
--
2.43.0
reply other threads:[~2026-11-03 21:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261103212655.1774644-1-Frank.Li@oss.nxp.com \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=andi.shyti@kernel.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=imx@lists.linux.dev \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=phasta@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=vkoul@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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®