* [PATCH v3 1/4] dmaengine: vchan: add vchan_chan_name() to get channel device name
2026-09-04 21:49 [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity Frank.Li
@ 2026-09-04 21:49 ` Frank.Li
2026-09-04 21:49 ` [PATCH v3 2/4] dmaengine: use dma_chan_name() helper to get per-channel " Frank.Li
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Frank.Li @ 2026-09-04 21:49 UTC (permalink / raw)
To: Jacky Huang, Shan-Chun Hung, Vinod Koul, Frank Li, Paul Cercueil,
Eugeniy Paltsev, Andy Shevchenko, Binbin Zhou, Patrice Chotard,
Amélie Delaunay, Maxime Coquelin, Alexandre Torgue,
Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Thierry Reding, Jonathan Hunter, Ludovic Desroches, Viresh Kumar,
Keguang Zhang, Andreas Färber, Manivannan Sadhasivam,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Kelvin Cao, Logan Gunthorpe,
Laxman Dewangan, Vignesh Raghavendra
Cc: linux-arm-kernel, dmaengine, linux-kernel, linux-mips,
linux-stm32, linux-trace-kernel, linux-tegra, linux-actions,
linux-sunxi, imx, Frank Li
From: Frank Li <Frank.Li@nxp.com>
Introduce vchan_chan_name() to obtain the DMA channel device name.
Use a dedicated helper instead of directly accessing dma_chan::dev
so callers remain unaffected by an upcoming rename of the struct member.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/dma/arm-dma350.c | 2 +-
drivers/dma/loongson/loongson2-apb-cmc-dma.c | 2 +-
drivers/dma/stm32/stm32-dma.c | 2 +-
drivers/dma/stm32/stm32-dma3.c | 4 ++--
drivers/dma/virt-dma.h | 11 +++++++++++
5 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
index 09403aca8bb06..52f5242ea3327 100644
--- a/drivers/dma/arm-dma350.c
+++ b/drivers/dma/arm-dma350.c
@@ -512,7 +512,7 @@ static int d350_alloc_chan_resources(struct dma_chan *chan)
{
struct d350_chan *dch = to_d350_chan(chan);
int ret = request_irq(dch->irq, d350_irq, IRQF_SHARED,
- dev_name(&dch->vc.chan.dev->device), dch);
+ vchan_chan_name(&dch->vc), dch);
if (!ret)
writel_relaxed(CH_INTREN_DONE | CH_INTREN_ERR, dch->base + CH_INTREN);
diff --git a/drivers/dma/loongson/loongson2-apb-cmc-dma.c b/drivers/dma/loongson/loongson2-apb-cmc-dma.c
index 1c9a542edc859..2f1c8c4fd0654 100644
--- a/drivers/dma/loongson/loongson2-apb-cmc-dma.c
+++ b/drivers/dma/loongson/loongson2-apb-cmc-dma.c
@@ -678,7 +678,7 @@ static int loongson2_cmc_dma_probe(struct platform_device *pdev)
return lchan->irq;
ret = devm_request_irq(dev, lchan->irq, loongson2_cmc_dma_chan_irq, IRQF_SHARED,
- dev_name(chan2dev(lchan)), lchan);
+ vchan_chan_name(&lchan->vchan), lchan);
if (ret)
return ret;
}
diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
index d3ad78562a140..3e8151e2ad75a 100644
--- a/drivers/dma/stm32/stm32-dma.c
+++ b/drivers/dma/stm32/stm32-dma.c
@@ -1668,7 +1668,7 @@ static int stm32_dma_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, chan->irq,
stm32_dma_chan_irq, 0,
- dev_name(chan2dev(chan)), chan);
+ vchan_chan_name(&chan->vchan), chan);
if (ret) {
dev_err(&pdev->dev,
"request_irq failed with err %d channel %d\n",
diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 4724e7fa0008e..1ee1bd22703fb 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -1892,10 +1892,10 @@ static int stm32_dma3_probe(struct platform_device *pdev)
chan->irq = ret;
ret = devm_request_irq(&pdev->dev, chan->irq, stm32_dma3_chan_irq, 0,
- dev_name(chan2dev(chan)), chan);
+ vchan_chan_name(&chan->vchan), chan);
if (ret) {
dev_err_probe(&pdev->dev, ret, "Failed to request channel %s IRQ\n",
- dev_name(chan2dev(chan)));
+ vchan_chan_name(&chan->vchan));
goto err_clk_disable;
}
}
diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h
index 59d9eabc8b674..dd023a3831209 100644
--- a/drivers/dma/virt-dma.h
+++ b/drivers/dma/virt-dma.h
@@ -209,6 +209,17 @@ static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)
vchan_dma_desc_free_list(vc, &head);
}
+/**
+ * vchan_chan_name - Return vchan DMA channel device name
+ * @vc: virtual channel
+ *
+ * Return: The name of the DMA channel device
+ */
+static inline const char *vchan_chan_name(struct virt_dma_chan *vc)
+{
+ return dma_chan_name(&vc->chan);
+}
+
/**
* vchan_synchronize() - synchronize callback execution to the current context
* @vc: virtual channel to synchronize
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v3 2/4] dmaengine: use dma_chan_name() helper to get per-channel device name
2026-09-04 21:49 [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity Frank.Li
2026-09-04 21:49 ` [PATCH v3 1/4] dmaengine: vchan: add vchan_chan_name() to get channel device name Frank.Li
@ 2026-09-04 21:49 ` Frank.Li
2026-09-05 7:55 ` Andy Shevchenko
2026-09-04 21:49 ` [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity Frank.Li
2026-09-05 8:00 ` [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev " Andy Shevchenko
3 siblings, 1 reply; 7+ messages in thread
From: Frank.Li @ 2026-09-04 21:49 UTC (permalink / raw)
To: Jacky Huang, Shan-Chun Hung, Vinod Koul, Frank Li, Paul Cercueil,
Eugeniy Paltsev, Andy Shevchenko, Binbin Zhou, Patrice Chotard,
Amélie Delaunay, Maxime Coquelin, Alexandre Torgue,
Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Thierry Reding, Jonathan Hunter, Ludovic Desroches, Viresh Kumar,
Keguang Zhang, Andreas Färber, Manivannan Sadhasivam,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Kelvin Cao, Logan Gunthorpe,
Laxman Dewangan, Vignesh Raghavendra
Cc: linux-arm-kernel, dmaengine, linux-kernel, linux-mips,
linux-stm32, linux-trace-kernel, linux-tegra, linux-actions,
linux-sunxi, imx, Frank Li
From: Frank Li <Frank.Li@nxp.com>
Use the existing dma_chan_name() helper to obtain the per-channel device
name instead of open-coding: dev_name(chan->dev->device) /
dev_name(chan2dev())
Simplify the code and improve consistency.
No functional change intended.
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/dma/dma-jz4780.c | 2 +-
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 2 +-
drivers/dma/idma64.c | 2 +-
drivers/dma/loongson/loongson2-apb-dma.c | 2 +-
drivers/dma/mmp_pdma.c | 2 +-
drivers/dma/st_fdma.c | 2 +-
drivers/dma/stm32/stm32-dma3.c | 2 +-
drivers/dma/stm32/stm32-mdma.c | 2 +-
include/trace/events/tegra_apb_dma.h | 6 +++---
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index 6070dfdb7114c..194649811d02b 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -760,7 +760,7 @@ static int jz4780_dma_alloc_chan_resources(struct dma_chan *chan)
{
struct jz4780_dma_chan *jzchan = to_jz4780_dma_chan(chan);
- jzchan->desc_pool = dma_pool_create(dev_name(&chan->dev->device),
+ jzchan->desc_pool = dma_pool_create(dma_chan_name(chan),
chan->device->dev,
JZ_DMA_DESC_BLOCK_SIZE,
PAGE_SIZE, 0);
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index 9c21a5479437d..7b50ba507cb02 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -531,7 +531,7 @@ static int dma_chan_alloc_chan_resources(struct dma_chan *dchan)
}
/* LLI address must be aligned to a 64-byte boundary */
- chan->desc_pool = dma_pool_create(dev_name(chan2dev(chan)),
+ chan->desc_pool = dma_pool_create(dma_chan_name(dchan),
chan->chip->dev,
sizeof(struct axi_dma_lli),
64, 0);
diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index 5fcd1befc92da..6399fd5408be2 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -507,7 +507,7 @@ static int idma64_alloc_chan_resources(struct dma_chan *chan)
struct idma64_chan *idma64c = to_idma64_chan(chan);
/* Create a pool of consistent memory blocks for hardware descriptors */
- idma64c->pool = dma_pool_create(dev_name(chan2dev(chan)),
+ idma64c->pool = dma_pool_create(dma_chan_name(chan),
chan->device->dev,
sizeof(struct idma64_lli), 8, 0);
if (!idma64c->pool) {
diff --git a/drivers/dma/loongson/loongson2-apb-dma.c b/drivers/dma/loongson/loongson2-apb-dma.c
index aceb069e71fca..7c3d7c3273955 100644
--- a/drivers/dma/loongson/loongson2-apb-dma.c
+++ b/drivers/dma/loongson/loongson2-apb-dma.c
@@ -282,7 +282,7 @@ static int ls2x_dma_alloc_chan_resources(struct dma_chan *chan)
struct ls2x_dma_chan *lchan = to_ldma_chan(chan);
/* Create a pool of consistent memory blocks for hardware descriptors */
- lchan->pool = dma_pool_create(dev_name(chan2dev(chan)),
+ lchan->pool = dma_pool_create(dma_chan_name(chan),
chan->device->dev, PAGE_SIZE,
__alignof__(struct ls2x_dma_hw_desc), 0);
if (!lchan->pool) {
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 386e85cd4882a..6b29e15b0616c 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -565,7 +565,7 @@ static int mmp_pdma_alloc_chan_resources(struct dma_chan *dchan)
if (chan->desc_pool)
return 1;
- chan->desc_pool = dma_pool_create(dev_name(&dchan->dev->device),
+ chan->desc_pool = dma_pool_create(dma_chan_name(dchan),
chan->dev,
sizeof(struct mmp_pdma_desc_sw),
__alignof__(struct mmp_pdma_desc_sw),
diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c
index d9547017f3bd6..35dbff5f9f1ab 100644
--- a/drivers/dma/st_fdma.c
+++ b/drivers/dma/st_fdma.c
@@ -268,7 +268,7 @@ static int st_fdma_alloc_chan_res(struct dma_chan *chan)
struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
/* Create the dma pool for descriptor allocation */
- fchan->node_pool = dma_pool_create(dev_name(&chan->dev->device),
+ fchan->node_pool = dma_pool_create(dma_chan_name(chan),
fchan->fdev->dev,
sizeof(struct st_fdma_hw_node),
__alignof__(struct st_fdma_hw_node),
diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 1ee1bd22703fb..6ee7a1435efb6 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -1126,7 +1126,7 @@ static int stm32_dma3_alloc_chan_resources(struct dma_chan *c)
goto err_put_sync;
}
- chan->lli_pool = dmam_pool_create(dev_name(&c->dev->device), c->device->dev,
+ chan->lli_pool = dmam_pool_create(dma_chan_name(c), c->device->dev,
sizeof(struct stm32_dma3_hwdesc),
__alignof__(struct stm32_dma3_hwdesc), SZ_64K);
if (!chan->lli_pool) {
diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
index e3bbdc9ee36ed..c274638e919c2 100644
--- a/drivers/dma/stm32/stm32-mdma.c
+++ b/drivers/dma/stm32/stm32-mdma.c
@@ -1484,7 +1484,7 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c)
struct stm32_mdma_device *dmadev = stm32_mdma_get_dev(chan);
int ret;
- chan->desc_pool = dmam_pool_create(dev_name(&c->dev->device),
+ chan->desc_pool = dmam_pool_create(dma_chan_name(c),
c->device->dev,
sizeof(struct stm32_mdma_hwdesc),
__alignof__(struct stm32_mdma_hwdesc),
diff --git a/include/trace/events/tegra_apb_dma.h b/include/trace/events/tegra_apb_dma.h
index 6d9f5075baa3e..c38117c127ef3 100644
--- a/include/trace/events/tegra_apb_dma.h
+++ b/include/trace/events/tegra_apb_dma.h
@@ -11,7 +11,7 @@ TRACE_EVENT(tegra_dma_tx_status,
TP_PROTO(struct dma_chan *dc, dma_cookie_t cookie, struct dma_tx_state *state),
TP_ARGS(dc, cookie, state),
TP_STRUCT__entry(
- __string(chan, dev_name(&dc->dev->device))
+ __string(chan, dma_chan_name(dc))
__field(dma_cookie_t, cookie)
__field(__u32, residue)
),
@@ -28,7 +28,7 @@ TRACE_EVENT(tegra_dma_complete_cb,
TP_PROTO(struct dma_chan *dc, int count, void *ptr),
TP_ARGS(dc, count, ptr),
TP_STRUCT__entry(
- __string(chan, dev_name(&dc->dev->device))
+ __string(chan, dma_chan_name(dc))
__field(int, count)
__field(void *, ptr)
),
@@ -45,7 +45,7 @@ TRACE_EVENT(tegra_dma_isr,
TP_PROTO(struct dma_chan *dc, int irq),
TP_ARGS(dc, irq),
TP_STRUCT__entry(
- __string(chan, dev_name(&dc->dev->device))
+ __string(chan, dma_chan_name(dc))
__field(int, irq)
),
TP_fast_assign(
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v3 2/4] dmaengine: use dma_chan_name() helper to get per-channel device name
2026-09-04 21:49 ` [PATCH v3 2/4] dmaengine: use dma_chan_name() helper to get per-channel " Frank.Li
@ 2026-09-05 7:55 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-05 7:55 UTC (permalink / raw)
To: Frank.Li
Cc: Jacky Huang, Shan-Chun Hung, Vinod Koul, Frank Li, Paul Cercueil,
Eugeniy Paltsev, Binbin Zhou, Patrice Chotard,
Amélie Delaunay, Maxime Coquelin, Alexandre Torgue,
Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Thierry Reding, Jonathan Hunter, Ludovic Desroches, Viresh Kumar,
Keguang Zhang, Andreas Färber, Manivannan Sadhasivam,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Kelvin Cao, Logan Gunthorpe,
Laxman Dewangan, Vignesh Raghavendra, linux-arm-kernel, dmaengine,
linux-kernel, linux-mips, linux-stm32, linux-trace-kernel,
linux-tegra, linux-actions, linux-sunxi, imx, Frank Li
On Fri, Sep 04, 2026 at 05:49:44PM -0400, Frank.Li@oss.nxp.com wrote:
> Use the existing dma_chan_name() helper to obtain the per-channel device
> name instead of open-coding: dev_name(chan->dev->device) /
> dev_name(chan2dev())
>
> Simplify the code and improve consistency.
>
> No functional change intended.
...
> @@ -507,7 +507,7 @@ static int idma64_alloc_chan_resources(struct dma_chan *chan)
> struct idma64_chan *idma64c = to_idma64_chan(chan);
>
> /* Create a pool of consistent memory blocks for hardware descriptors */
> - idma64c->pool = dma_pool_create(dev_name(chan2dev(chan)),
> + idma64c->pool = dma_pool_create(dma_chan_name(chan),
> chan->device->dev,
> sizeof(struct idma64_lli), 8, 0);
For example here it may now be condensed to less LoC:
idma64c->pool = dma_pool_create(dma_chan_name(chan), chan->device->dev,
sizeof(struct idma64_lli), 8, 0);
Consider that in case you will need a new version (no need
to address it separately).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity
2026-09-04 21:49 [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity Frank.Li
2026-09-04 21:49 ` [PATCH v3 1/4] dmaengine: vchan: add vchan_chan_name() to get channel device name Frank.Li
2026-09-04 21:49 ` [PATCH v3 2/4] dmaengine: use dma_chan_name() helper to get per-channel " Frank.Li
@ 2026-09-04 21:49 ` Frank.Li
2026-09-05 7:59 ` Andy Shevchenko
2026-09-05 8:00 ` [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev " Andy Shevchenko
3 siblings, 1 reply; 7+ messages in thread
From: Frank.Li @ 2026-09-04 21:49 UTC (permalink / raw)
To: Jacky Huang, Shan-Chun Hung, Vinod Koul, Frank Li, Paul Cercueil,
Eugeniy Paltsev, Andy Shevchenko, Binbin Zhou, Patrice Chotard,
Amélie Delaunay, Maxime Coquelin, Alexandre Torgue,
Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Thierry Reding, Jonathan Hunter, Ludovic Desroches, Viresh Kumar,
Keguang Zhang, Andreas Färber, Manivannan Sadhasivam,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Kelvin Cao, Logan Gunthorpe,
Laxman Dewangan, Vignesh Raghavendra
Cc: linux-arm-kernel, dmaengine, linux-kernel, linux-mips,
linux-stm32, linux-trace-kernel, linux-tegra, linux-actions,
linux-sunxi, imx, Frank Li
From: Frank Li <Frank.Li@nxp.com>
The current dma_chan structure contains both "device" and "dev". So
chan->device->dev refers to the DMA engine device.
chan->dev->device refers to the per-channel device instance.
Their similar naming makes the distinction unclear and increases reader
confusion.
Add union dma_chan::chan_dev to make its purpose explicit and clearly
identify it as the per-channel device. After all user switch to chan_dev,
union and dma_chan::dev will be removed.
Update the kernel-doc accordingly. Besides its sysfs usage, the per-channel
device is also used by some DMA engine drivers for IOMMU mapping and
therefore deserves a more accurate description.
No functional change intended.
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
there are other user use it outside drivers/dma/ directory.
---
drivers/dma/dmaengine.c | 14 +++++++-------
drivers/dma/tegra186-gpc-dma.c | 2 +-
drivers/dma/ti/k3-udma.c | 4 ++--
include/linux/dmaengine.h | 18 +++++++++++++-----
4 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index a7ac2729e4d9d..bb30a9aa54d3f 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -1083,8 +1083,8 @@ static int __dma_async_device_channel_register(struct dma_device *device,
chan->local = alloc_percpu(typeof(*chan->local));
if (!chan->local)
return -ENOMEM;
- chan->dev = kzalloc_obj(*chan->dev);
- if (!chan->dev) {
+ chan->chan_dev = kzalloc_obj(*chan->chan_dev);
+ if (!chan->chan_dev) {
rc = -ENOMEM;
goto err_free_local;
}
@@ -1103,8 +1103,8 @@ static int __dma_async_device_channel_register(struct dma_device *device,
dmaengine_chan_dev(chan)->class = &dma_devclass;
dmaengine_chan_dev(chan)->parent = device->dev;
- chan->dev->chan = chan;
- chan->dev->dev_id = device->dev_id;
+ chan->chan_dev->chan = chan;
+ chan->chan_dev->dev_id = device->dev_id;
spin_lock_init(&chan->lock);
if (!name)
@@ -1122,7 +1122,7 @@ static int __dma_async_device_channel_register(struct dma_device *device,
err_out_ida:
ida_free(&device->chan_ida, chan->chan_id);
err_free_dev:
- kfree(chan->dev);
+ kfree(chan->chan_dev);
err_free_local:
free_percpu(chan->local);
chan->local = NULL;
@@ -1155,7 +1155,7 @@ static void __dma_async_device_channel_unregister(struct dma_device *device,
__func__, chan->client_count);
mutex_lock(&dma_list_mutex);
device->chancnt--;
- chan->dev->chan = NULL;
+ chan->chan_dev->chan = NULL;
mutex_unlock(&dma_list_mutex);
ida_free(&device->chan_ida, chan->chan_id);
device_unregister(dmaengine_chan_dev(chan));
@@ -1290,7 +1290,7 @@ int dma_async_device_register(struct dma_device *device)
if (chan->local == NULL)
continue;
mutex_lock(&dma_list_mutex);
- chan->dev->chan = NULL;
+ chan->chan_dev->chan = NULL;
mutex_unlock(&dma_list_mutex);
device_unregister(dmaengine_chan_dev(chan));
free_percpu(chan->local);
diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index b3327aa35de40..e76c58f213d84 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -1554,7 +1554,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
return dev_err_probe(chdev, -EINVAL,
"Failed to get stream ID for channel %d\n", tdc->id);
- chan->dev->chan_dma_dev = true;
+ chan->chan_dev->chan_dma_dev = true;
}
/* program stream-id for this channel */
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 49e2d0014d5ed..78a67cb9d6e00 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -426,12 +426,12 @@ static void k3_configure_chan_coherency(struct dma_chan *chan, u32 asel)
if (asel == 0) {
/* No special handling for the channel */
- chan->dev->chan_dma_dev = false;
+ chan->chan_dev->chan_dma_dev = false;
dev_clear_dma_coherent(chan_dev);
chan_dev->dma_parms = NULL;
} else if (asel == 14 || asel == 15) {
- chan->dev->chan_dma_dev = true;
+ chan->chan_dev->chan_dma_dev = true;
dev_set_dma_coherent(chan_dev);
dma_coerce_mask_and_coherent(chan_dev, DMA_BIT_MASK(48));
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 33aa1bfc8fb84..206c5dab96cd7 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -325,7 +325,8 @@ struct dma_router {
* @lock: protect between config and prepare transfer when driver have not
* implemented callback device_prep_config_sg().
* @chan_id: channel ID for sysfs
- * @dev: class device for sysfs
+ * @chan_dev: class channel device for sysfs, some device use it for per-channel
+ * iommu mapping.
* @name: backlink name for sysfs
* @dbg_client_name: slave name for debugfs in format:
* dev_name(requester's dev):channel name, for example: "2b00000.mcasp:tx"
@@ -351,7 +352,14 @@ struct dma_chan {
/* sysfs */
int chan_id;
- struct dma_chan_dev *dev;
+ union {
+ struct dma_chan_dev *chan_dev;
+ /*
+ * please use chan_dev, dev will be removed after all user
+ switch to chan_dev
+ */
+ struct dma_chan_dev *dev;
+ };
const char *name;
#ifdef CONFIG_DEBUG_FS
char *dbg_client_name;
@@ -532,7 +540,7 @@ struct dma_slave_caps {
static inline const char *dma_chan_name(struct dma_chan *chan)
{
- return dev_name(&chan->dev->device);
+ return dev_name(&chan->chan_dev->device);
}
/**
@@ -1805,12 +1813,12 @@ dmaengine_get_direction_text(enum dma_transfer_direction dir)
static inline struct device *dmaengine_chan_dev(struct dma_chan *chan)
{
- return &chan->dev->device;
+ return &chan->chan_dev->device;
}
static inline struct device *dmaengine_get_dma_device(struct dma_chan *chan)
{
- if (chan->dev->chan_dma_dev)
+ if (chan->chan_dev->chan_dma_dev)
return dmaengine_chan_dev(chan);
return chan->device->dev;
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity
2026-09-04 21:49 ` [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity Frank.Li
@ 2026-09-05 7:59 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-05 7:59 UTC (permalink / raw)
To: Frank.Li
Cc: Jacky Huang, Shan-Chun Hung, Vinod Koul, Frank Li, Paul Cercueil,
Eugeniy Paltsev, Binbin Zhou, Patrice Chotard,
Amélie Delaunay, Maxime Coquelin, Alexandre Torgue,
Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Thierry Reding, Jonathan Hunter, Ludovic Desroches, Viresh Kumar,
Keguang Zhang, Andreas Färber, Manivannan Sadhasivam,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Kelvin Cao, Logan Gunthorpe,
Laxman Dewangan, Vignesh Raghavendra, linux-arm-kernel, dmaengine,
linux-kernel, linux-mips, linux-stm32, linux-trace-kernel,
linux-tegra, linux-actions, linux-sunxi, imx, Frank Li
On Fri, Sep 04, 2026 at 05:49:46PM -0400, Frank.Li@oss.nxp.com wrote:
> The current dma_chan structure contains both "device" and "dev". So
>
> chan->device->dev refers to the DMA engine device.
> chan->dev->device refers to the per-channel device instance.
>
> Their similar naming makes the distinction unclear and increases reader
> confusion.
>
> Add union dma_chan::chan_dev to make its purpose explicit and clearly
> identify it as the per-channel device. After all user switch to chan_dev,
> union and dma_chan::dev will be removed.
>
> Update the kernel-doc accordingly. Besides its sysfs usage, the per-channel
> device is also used by some DMA engine drivers for IOMMU mapping and
> therefore deserves a more accurate description.
>
> No functional change intended.
I was almost ready to give a tag for the entire series, but found a minor
issue here...
...
> +++ b/include/linux/dmaengine.h
> struct dma_router {
> * @lock: protect between config and prepare transfer when driver have not
> * implemented callback device_prep_config_sg().
> * @chan_id: channel ID for sysfs
> - * @dev: class device for sysfs
> + * @chan_dev: class channel device for sysfs, some device use it for per-channel
> + * iommu mapping.
IOMMU
> * @name: backlink name for sysfs
> * @dbg_client_name: slave name for debugfs in format:
> * dev_name(requester's dev):channel name, for example: "2b00000.mcasp:tx"
> struct dma_chan {
>
> /* sysfs */
> int chan_id;
> - struct dma_chan_dev *dev;
> + union {
> + struct dma_chan_dev *chan_dev;
> + /*
> + * please use chan_dev, dev will be removed after all user
> + switch to chan_dev
> + */
Something went wrong with this comment style. It also need to respect English
grammar and punctuation as we do for multi-line comments.
> + struct dma_chan_dev *dev;
> + };
> const char *name;
> #ifdef CONFIG_DEBUG_FS
> char *dbg_client_name;
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity
2026-09-04 21:49 [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity Frank.Li
` (2 preceding siblings ...)
2026-09-04 21:49 ` [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity Frank.Li
@ 2026-09-05 8:00 ` Andy Shevchenko
3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-05 8:00 UTC (permalink / raw)
To: Frank.Li
Cc: Jacky Huang, Shan-Chun Hung, Vinod Koul, Frank Li, Paul Cercueil,
Eugeniy Paltsev, Binbin Zhou, Patrice Chotard,
Amélie Delaunay, Maxime Coquelin, Alexandre Torgue,
Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Thierry Reding, Jonathan Hunter, Ludovic Desroches, Viresh Kumar,
Keguang Zhang, Andreas Färber, Manivannan Sadhasivam,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Kelvin Cao, Logan Gunthorpe,
Laxman Dewangan, Vignesh Raghavendra, linux-arm-kernel, dmaengine,
linux-kernel, linux-mips, linux-stm32, linux-trace-kernel,
linux-tegra, linux-actions, linux-sunxi, imx, Frank Li
On Fri, Sep 04, 2026 at 05:49:42PM -0400, Frank.Li@oss.nxp.com wrote:
> The current dma_chan structure contains both "device" and "dev". So
>
> chan->device->dev refers to the DMA engine device.
> chan->dev->device refers to the per-channel device instance.
>
> Their similar naming makes the distinction unclear and increases reader
> confusion.
>
> Add union dma_chan::chan_dev to make its purpose explicit and clearly
> identify it as the per-channel device. After all user switch to chan_dev,
> union and dma_chan::dev will be removed.
>
> Update the kernel-doc accordingly. Besides its sysfs usage, the per-channel
> device is also used by some DMA engine drivers for IOMMU mapping and
> therefore deserves a more accurate description.
>
> 1st patch add help vchan_chan_name()
> 2nd patch use existing helper dma_chan_name() to reduce rename difference.
> 3rd patch add (dmaengine|vchan)_chan_dev() helper
> 4th patch add union chan_dev for dma_chan::dev for clarity
>
> Need following patch to clean other dma engineer driver, which is not
> in drivers/dma
>
> After complete all rename work, dma_chan::dev can be removed.
Nice work!
I have one comment against patch 4/4, after addressing that feel free to add
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
to the entire series.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread