From: anish kumar <yesanishhere@gmail.com>
To: corbet@lwn.net, tj@kernel.org, akpm@linux-foundation.org,
ptesarik@suse.com, xavier_qy@163.com, vbabka@suse.cz,
tintinm2017@gmail.com
Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
anish kumar <yesanishhere@gmail.com>
Subject: [RFC PATCH 2/2] dmapool: Documentation: use the kernel-doc comment
Date: Tue, 12 Nov 2024 22:34:25 -0800 [thread overview]
Message-ID: <20241113063425.21042-3-yesanishhere@gmail.com> (raw)
In-Reply-To: <20241113063425.21042-1-yesanishhere@gmail.com>
In an effort to modernize the documentation for
dma api, move the api explanation to kernel-doc comment
in the source code and use the kernel-doc here in
the documentation.
Signed-off-by: anish kumar <yesanishhere@gmail.com>
---
Documentation/core-api/dma-api.rst | 66 ++++++------------------------
1 file changed, 12 insertions(+), 54 deletions(-)
diff --git a/Documentation/core-api/dma-api.rst b/Documentation/core-api/dma-api.rst
index 8e3cce3d0a23..8e89f328ba54 100644
--- a/Documentation/core-api/dma-api.rst
+++ b/Documentation/core-api/dma-api.rst
@@ -86,65 +86,23 @@ not __get_free_pages(). Also, they understand common hardware constraints
for alignment, like queue heads needing to be aligned on N-byte boundaries.
-::
-
- struct dma_pool *
- dma_pool_create(const char *name, struct device *dev,
- size_t size, size_t align, size_t alloc);
-
-dma_pool_create() initializes a pool of DMA-coherent buffers
-for use with a given device. It must be called in a context which
-can sleep.
-
-The "name" is for diagnostics (like a struct kmem_cache name); dev and size
-are like what you'd pass to dma_alloc_coherent(). The device's hardware
-alignment requirement for this type of data is "align" (which is expressed
-in bytes, and must be a power of two). If your device has no boundary
-crossing restrictions, pass 0 for alloc; passing 4096 says memory allocated
-from this pool must not cross 4KByte boundaries.
-
-::
-
- void *
- dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags,
- dma_addr_t *handle)
-
-Wraps dma_pool_alloc() and also zeroes the returned memory if the
-allocation attempt succeeded.
-
+.. kernel-doc:: mm/dmapool.c
+ :identifiers: dma_pool_create
-::
-
- void *
- dma_pool_alloc(struct dma_pool *pool, gfp_t gfp_flags,
- dma_addr_t *dma_handle);
-
-This allocates memory from the pool; the returned memory will meet the
-size and alignment requirements specified at creation time. Pass
-GFP_ATOMIC to prevent blocking, or if it's permitted (not
-in_interrupt, not holding SMP locks), pass GFP_KERNEL to allow
-blocking. Like dma_alloc_coherent(), this returns two values: an
-address usable by the CPU, and the DMA address usable by the pool's
-device.
-
-::
+.. kernel-doc:: mm/dmapool.c
+ :identifiers: dma_pool_alloc
- void
- dma_pool_free(struct dma_pool *pool, void *vaddr,
- dma_addr_t addr);
+dma_pool_zalloc wraps dma_pool_alloc() and also zeroes the returned memory
+if the allocation attempt succeeded.
-This puts memory back into the pool. The pool is what was passed to
-dma_pool_alloc(); the CPU (vaddr) and DMA addresses are what
-were returned when that routine allocated the memory being freed.
+.. kernel-doc:: mm/dmapool.c
+ :identifiers: dma_pool_create
-::
-
- void
- dma_pool_destroy(struct dma_pool *pool);
+.. kernel-doc:: mm/dmapool.c
+ :identifiers: dma_pool_free
-dma_pool_destroy() frees the resources of the pool. It must be
-called in a context which can sleep. Make sure you've freed all allocated
-memory back to the pool before you destroy it.
+.. kernel-doc:: mm/dmapool.c
+ :identifiers: dma_pool_destroy
Part Ic - DMA addressing limitations
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2024-11-13 6:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 6:34 [RFC PATCH 0/2] modernize DMA api documentation anish kumar
2024-11-13 6:34 ` [RFC PATCH 1/2] dmapool: Improve dma api kernel-doc comments anish kumar
2024-11-13 6:34 ` anish kumar [this message]
2024-11-14 6:12 ` [RFC PATCH 0/2] modernize DMA api documentation Randy Dunlap
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=20241113063425.21042-3-yesanishhere@gmail.com \
--to=yesanishhere@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ptesarik@suse.com \
--cc=tintinm2017@gmail.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
--cc=xavier_qy@163.com \
/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