DMA Engine development
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Vinod Koul" <vkoul@kernel.org>, "Frank Li" <Frank.li@nxp.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Christophe Jaillet" <christophe.jaillet@wanadoo.fr>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Kelvin Cao" <kelvin.cao@microchip.com>
Subject: Re: [PATCH v4 1/4] dmaengine: add per-channel sysfs attribute groups via chan_groups
Date: Tue, 17 Nov 2026 12:27:50 -0600	[thread overview]
Message-ID: <b3058fbd-151a-4cb4-b5fe-e55964d5f8a3@deltatee.com> (raw)
In-Reply-To: <avyWCL7TzS9JX4Ys@lizhi-Precision-Tower-5810>



On 2026-11-17 11:59, Frank Li wrote:
> On Tue, Nov 10, 2026 at 11:31:33AM -0600, Logan Gunthorpe wrote:
>>  static ssize_t memcpy_count_show(struct device *dev,
>>  				 struct device_attribute *attr, char *buf)
>>  {
>> @@ -1117,6 +1143,7 @@ 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;
>> +	dmaengine_chan_dev(chan)->groups = device->chan_groups;
> 
> if echo channel have same groups, why need copy it to dma_chan?

The groups pointer belong to each channel, so each dma_chan must set its
groups to the chan_groups pointer stored in the device. The only way to
add these groups is to set dma_chan->groups to something and the pointer
stored chan_groups is exactly what it is there for. I can't see any
other way to accomplish this. It makes no sense for each channel to have
different groups.
>> +/*
>> + * dmaengine_chan_from_dev_lock() / dmaengine_chan_from_dev_unlock() bracket
>> + * a critical section across which a channel's struct device can be safely
>> + * converted back to its struct dma_chan: dmaengine_chan_from_dev_lock()
>> + * returns NULL if the channel has already been unregistered, and the lock
> 
> where return NULL when already been unregistered
> 
> static struct dma_chan *dev_to_dma_chan(struct device *dev)
> {
>         struct dma_chan_dev *chan_dev;
> 
>         chan_dev = container_of(dev, typeof(*chan_dev), device);
>         return chan_dev->chan;
> }
__dma_async_device_channel_unregister() will set chan_dev->chan to NULL
while holding the dma_list_mutex lock.

Thanks for reviewing this,

Logan

  reply	other threads:[~2026-11-17 18:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 17:31 [PATCH v4 0/4] Add sysfs interface to switchtec-dma Logan Gunthorpe
2026-11-10 17:31 ` [PATCH v4 1/4] dmaengine: add per-channel sysfs attribute groups via chan_groups Logan Gunthorpe
2026-11-17 17:59   ` Frank Li
2026-11-17 18:27     ` Logan Gunthorpe [this message]
2026-11-10 17:31 ` [PATCH v4 2/4] dmaengine: ioatdma: convert per-channel sysfs to chan_groups Logan Gunthorpe
2026-11-17 18:01   ` Frank Li
2026-11-10 17:31 ` [PATCH v4 3/4] dmaengine: switchtec-dma: add config sysfs attributes Logan Gunthorpe
2026-11-10 17:31 ` [PATCH v4 4/4] dmaengine: switchtec-dma: add pmon " Logan Gunthorpe
2026-11-10 17:47   ` sashiko-bot
2026-11-10 17:50     ` Logan Gunthorpe

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=b3058fbd-151a-4cb4-b5fe-e55964d5f8a3@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Frank.li@nxp.com \
    --cc=Frank.li@oss.nxp.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=kelvin.cao@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --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