Re: [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity
From: Andy Shevchenko
Date: Sat Sep 05 2026 - 04:00:05 EST
On Fri, Sep 04, 2026 at 05:49:46PM -0400, Frank.Li@xxxxxxxxxxx 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