The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bogdan Mahomet <bogdan.mahomet.dev@gmail.com>
To: Vinod Koul <vkoul@kernel.org>, Jonathan Corbet <corbet@lwn.net>
Cc: Frank Li <Frank.Li@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	dmaengine@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Bogdan Mahomet <bogdan.mahomet.dev@gmail.com>
Subject: [PATCH] docs: dmaengine: document ownership of the descriptor flags field
Date: Sat, 22 Aug 2026 03:15:30 +0300	[thread overview]
Message-ID: <20260822001536.29269-1-bogdan.mahomet.dev@gmail.com> (raw)

The flags field of struct dma_async_tx_descriptor has carried a TODO
since the provider documentation was added in 2014, asking whether a
driver may modify the field itself or whether it must always hold the
flags passed in the arguments.

The field belongs to the client. dma_async_tx_descriptor_init() does
not touch it, so the provider has to set it, and providers store the
flags they were given verbatim; vchan_tx_prep() does this for every
driver built on top of virt-dma. Afterwards providers only read the
field: the DMA_PREP_* bits are consumed while the descriptor is being
prepared, and DMA_CTRL_ACK and DMA_CTRL_REUSE are tested with
async_tx_test_ack() and dmaengine_desc_test_reuse() before a
descriptor is recycled or freed.

Once a descriptor has been prepared, nothing in the tree changes the
field except the client helpers in include/linux/dmaengine.h:
async_tx_ack(), async_tx_clear_ack(), dmaengine_desc_set_reuse() and
dmaengine_desc_clear_reuse().

Document that rule in place of the TODO.

Signed-off-by: Bogdan Mahomet <bogdan.mahomet.dev@gmail.com>
---
 Documentation/driver-api/dmaengine/provider.rst | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst
index f4ed98f701c9..c10d8ab8fdbd 100644
--- a/Documentation/driver-api/dmaengine/provider.rst
+++ b/Documentation/driver-api/dmaengine/provider.rst
@@ -413,9 +413,11 @@ supported.
 
   - You'll also need to set following fields in this structure:
 
-    - flags:
-      TODO: Can it be modified by the driver itself, or
-      should it be always the flags passed in the arguments
+    - flags: this field belongs to the client. The driver stores the
+      flags passed in the arguments and must not modify them. It reads
+      the DMA_PREP_* bits while preparing the descriptor, and must only
+      test DMA_CTRL_ACK and DMA_CTRL_REUSE, which the client may change
+      after the descriptor has been prepared.
 
     - tx_submit: A pointer to a function you have to implement,
       that is supposed to push the current transaction descriptor to a
-- 
2.55.0


                 reply	other threads:[~2026-08-22  0:16 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=20260822001536.29269-1-bogdan.mahomet.dev@gmail.com \
    --to=bogdan.mahomet.dev@gmail.com \
    --cc=Frank.Li@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --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