[v3,0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity

Message ID 20260904-dma-chan_dev-rename-v3-0-685601b0b788@nxp.com (mailing list archive)
Headers
Series dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity |

Message

Frank Li Sept. 4, 2026, 9:49 p.m. UTC
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.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Changes in v3:
- add new helper function dmaengine_chan_dev() and vchan_chan_dev() to
make clear.
- some reduntant error message will be addressed by new patches.
- Link to v2: https://patch.msgid.link/20260903-dma-chan_dev-rename-v2-0-0db305b6c716@nxp.com

Changes in v2:
- rebase to dmaengine/next
- add vchan_chan_name() help function for vchan case.
- Link to v1: https://patch.msgid.link/20260812-dma-chan_dev-rename-v1-0-a67131f7d5c2@nxp.com

---
Frank Li (4):
      dmaengine: vchan: add vchan_chan_name() to get channel device name
      dmaengine: use dma_chan_name() helper to get per-channel device name
      dmaengine: add (dmaengine|vchan)_chan_dev() helper
      dmaengine: add union chan_dev for dma_chan::dev for clarity

 drivers/dma/arm-dma350.c                       |   2 +-
 drivers/dma/at_hdmac.c                         |  81 ++++++-------
 drivers/dma/at_xdmac.c                         | 159 ++++++++++++-------------
 drivers/dma/dma-jz4780.c                       |  10 +-
 drivers/dma/dmaengine.c                        |  34 +++---
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c |  38 +++---
 drivers/dma/dw-axi-dmac/dw-axi-dmac.h          |  10 --
 drivers/dma/dw/core.c                          |  47 ++++----
 drivers/dma/ep93xx_dma.c                       |  37 +++---
 drivers/dma/idma64.c                           |   9 +-
 drivers/dma/loongson/loongson1-apb-dma.c       |  23 ++--
 drivers/dma/loongson/loongson2-apb-cmc-dma.c   |  17 +--
 drivers/dma/loongson/loongson2-apb-dma.c       |   9 +-
 drivers/dma/mmp_pdma.c                         |   2 +-
 drivers/dma/moxart-dma.c                       |  23 ++--
 drivers/dma/nbpfaxi.c                          |   2 +-
 drivers/dma/owl-dma.c                          |  21 ++--
 drivers/dma/pch_dma.c                          |  41 +++----
 drivers/dma/pxa_dma.c                          |  52 ++++----
 drivers/dma/st_fdma.c                          |   2 +-
 drivers/dma/ste_dma40.c                        |  15 +--
 drivers/dma/stm32/stm32-dma.c                  |  69 +++++------
 drivers/dma/stm32/stm32-dma3.c                 |  99 ++++++++-------
 drivers/dma/stm32/stm32-mdma.c                 |  95 +++++++--------
 drivers/dma/sun4i-dma.c                        |  17 +--
 drivers/dma/sun6i-dma.c                        |  31 ++---
 drivers/dma/switchtec_dma.c                    |  14 +--
 drivers/dma/tegra186-gpc-dma.c                 |   4 +-
 drivers/dma/tegra20-apb-dma.c                  |   2 +-
 drivers/dma/ti/k3-udma.c                       |   6 +-
 drivers/dma/timb_dma.c                         |  63 +++++-----
 drivers/dma/txx9dmac.c                         |  73 ++++++------
 drivers/dma/virt-dma.h                         |  16 +++
 include/linux/dmaengine.h                      |  23 +++-
 include/trace/events/tegra_apb_dma.h           |   6 +-
 35 files changed, 538 insertions(+), 614 deletions(-)
---
base-commit: 5c7962210474adbd9874227bc5096dbc11501d34
change-id: 20260812-dma-chan_dev-rename-66263ac5eac9

Best regards,
--  
Frank Li <Frank.Li@nxp.com>
  

Comments

Andy Shevchenko Sept. 5, 2026, 8 a.m. UTC | #1
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.