clean up dma-buf-io kerneldocs
Subsystems (3)
v2 cover clean up dma-buf-io kerneldocs
Add a kerneldoc for dma_buf_io_init_map() and clean up it overall. Targeting the Jens' branch where dma-buf-io sits. If preferred, it can all be squashed into
0d3120db2cbe0a ("dma-buf: introduce initial file I/O infrastructure")
Pavel Begunkov (2):
dma-buf-io: fix typos in kernel docs
dma-buf-io: document dma_buf_io_init_map
drivers/dma-buf/dma-buf-io.c | 32 ++++++++++++++++++++++---------- include/linux/dma-buf-io.h | 7 ++++--- 2 files changed, 26 insertions(+), 13 deletions(-)
Signature · 1 line
2.54.0
PATCH v2 1/2 dma-buf-io: fix typos in kernel docs
Fix some typos and inconsistencies in dma-buf-io kernel docs.
--- drivers/dma-buf/dma-buf-io.c | 20 ++++++++++---------- include/linux/dma-buf-io.h | 7 ++++--- 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/dma-buf/dma-buf-io.c +10 -10
@@ -106,7 +106,7 @@ static struct dma_buf_io_map *__dma_buf_io_create_map(struct dma_buf_io_ctx *ctx* @ctx: [in] dma-buf I/O context * * A slow path part of dma_buf_io_get_map() and shouldn't be used directly. -* Behaves in the same way but allowed to block. +* Behaves in the same way but is allowed to block. * * Returns a map on success, or ERR_PTR encoded errno otherwise. */
@@ -133,16 +133,16 @@ static void dma_buf_io_ctx_shutdown(struct dma_buf_io_ctx *ctx) }/* -* dma_buf_io_ctx_create - create a new dma-buf I/O context for the given file. +* dma_buf_io_ctx_create - Create a new dma-buf I/O context for the given file. * @file: [in] file for which the context is created * @dmabuf: [in] buffer to create a context from * @dir: [in] direction of DMA transfers -* @out_ctx [out] resulting ctx +* @out_ctx: [out] resulting ctx * * Create a new I/O context from the given DMA buffer for the given file. * It only works with files implementing ->init_dma_buf_io_ctx and fails * with -EOPNOTSUPP otherwise. Once created, the user can create a map -* and use it to issue I/O like read / write requests to @file. +* and use it to issue I/O, such as read/write requests, to @file. */ int dma_buf_io_ctx_create(struct file *file, struct dma_buf *dmabuf,
@@ -180,7 +180,7 @@ int dma_buf_io_ctx_create(struct file *file, }/** -* dma_buf_io_ctx_release - destroy the I/O context +* dma_buf_io_ctx_release - Destroy the I/O context * @ctx: [in] dma-buf I/O context * * Destroy the context. It makes sure all maps are waited on and destroyed,
@@ -201,11 +201,11 @@ void dma_buf_io_ctx_release(struct dma_buf_io_ctx *ctx) }/** -* dma_buf_io_invalidate_mappings - invalidate the current map +* dma_buf_io_invalidate_mappings - Invalidate the current map * @ctx: [in] dma-buf I/O context * * Importer's helper for invalidating the current map. Waits for all I/O -* using the map to complete and destroyes the map. Called with the +* using the map to complete and destroys the map. Called with the * dma-buf reservation lock held. */ void dma_buf_io_invalidate_mappings (struct dma_buf_io_ctx *ctx)
@@ -215,11 +215,11 @@ void dma_buf_io_invalidate_mappings(struct dma_buf_io_ctx *ctx)EXPORT_SYMBOL_NS_GPL (dma_buf_io_invalidate_mappings,"DMA_BUF" );/** -* dma_buf_io_detach - detach the @ctx from the importer. +* dma_buf_io_detach - Detach the @ctx from the importer. * @ctx: [in] dma-buf I/O context * -* Importer's helper for removing the I/O ctx. It kills all maps and -* prevents creation of new ones. Upon return it's safe for the importer +* Importer's helper for removing the I/O context. It kills all maps and +* prevents creation of new ones. Upon return, it's safe for the importer * to release all its resources such as dma-buf attachments. */ void dma_buf_io_detach (struct dma_buf_io_ctx *ctx)
include/linux/dma-buf-io.h +4 -3
@@ -60,6 +60,7 @@ void dma_buf_io_ctx_release(struct dma_buf_io_ctx *ctx);struct dma_buf_io_map *dma_buf_io_create_map (struct dma_buf_io_ctx *ctx); +/* Internal helper, see dma_buf_io_get_map() */ static inline struct dma_buf_io_map *__dma_buf_io_get_map (struct dma_buf_io_ctx *ctx) {
@@ -79,10 +80,10 @@ __dma_buf_io_get_map(struct dma_buf_io_ctx *ctx)* @ctx: [in] dma-buf I/O context * @nowait: [in] specifies whether it's allowed to block * -* Create a new or acquire an existing map. When succeeds, it returns +* Create a new or acquire an existing map. On success, it returns * a referenced map, which should eventually be put down with * dma_buf_io_map_drop(). If @nowait is set and the function would block, -* it return -EAGAIN, and the caller is expected to retry from a context +* it returns -EAGAIN, and the caller is expected to retry from a context * where blocking is allowed. * * Returns a map on success, or ERR_PTR encoded errno otherwise.
@@ -105,7 +106,7 @@ dma_buf_io_get_map(struct dma_buf_io_ctx *ctx, bool nowait)* dma_buf_io_map_drop - Drop the map. * @map: [in] dma-buf I/O map * -* Put down a reference for the @map acquired via dma_buf_io_get_map(). +* Put down a reference to the @map acquired via dma_buf_io_get_map(). * Should be called as soon as I/O is completed. */ static inline void dma_buf_io_map_drop (struct dma_buf_io_map *map)
Signature · 1 line
2.54.0
PATCH v2 2/2 dma-buf-io: document dma_buf_io_init_map
In reply to Pavel BegunkovAdd a kerneldoc for dma_buf_io_init_map().
--- drivers/dma-buf/dma-buf-io.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/dma-buf/dma-buf-io.c +12 -0
@@ -43,6 +43,18 @@ static void dma_buf_io_kill_map(struct dma_buf_io_ctx *ctx)dma_buf_io_map_release (map); } +/** +* dma_buf_io_init_map - Initialise the map. +* @ctx: [in] dma-buf I/O context the map is created for +* @map: [in] dma-buf I/O map +* @sgt: [in] the backing scatter-gather table +* +* Importer's helper that initialises @map for the provided I/O context +* and scatter-gather table. The importer should call it once for each map +* on creation. +* +* Return: 0 on success, or a negative errno code otherwise. +*/ int dma_buf_io_init_map (struct dma_buf_io_ctx *ctx,struct dma_buf_io_map *map,struct sg_table *sgt) {
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 2/2] dma-buf-io: document dma_buf_io_init_map
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dma-buf: incorrect documentation of map parameter direction --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dma-buf: incorrect documentation of map parameter direction
--
commit 1158f35d78a501cf423bc44ae35a1645c81c621d
Author: Pavel Begunkov <[email protected]>
dma-buf-io: document dma_buf_io_init_map
This commit adds a kerneldoc for dma_buf_io_init_map().
drivers/dma-buf/dma-buf-io.c static void dma_buf_io_kill_map(struct dma_buf_io_ctx *ctx) · line 49
Quoted 12 lines
drivers/dma-buf/dma-buf-io.c +4
-0@@ -43,6 +43,18 @@ static void dma_buf_io_kill_map(struct dma_buf_io_ctx *ctx)dma_buf_io_map_release (map); } +/** +* dma_buf_io_init_map - Initialise the map. +* @ctx: [in] dma-buf I/O context the map is created for +* @map: [in] dma-buf I/O map
[Severity: Low]
Is the [in] annotation correct for the map parameter here? Since dma_buf_io_init_map() initializes the internal fields of the map struct, this functions as an output parameter. Should this be documented as [out] or [in,out] instead?
Quoted 10 lines
drivers/dma-buf/dma-buf-io.c +8
-0+* @sgt: [in] the backing scatter-gather table +* +* Importer's helper that initialises @map for the provided I/O context +* and scatter-gather table. The importer should call it once for each map +* on creation. +* +* Return: 0 on success, or a negative errno code otherwise. +*/ int dma_buf_io_init_map (struct dma_buf_io_ctx *ctx,struct dma_buf_io_map *map,struct sg_table *sgt)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Quoted 11 lines · Pavel Begunkov
Add a kerneldoc for
dma_buf_io_init_map()and clean up it overall. Targeting the Jens' branch where dma-buf-io sits. If preferred, it can all be squashed into
0d3120db2cbe0a("dma-buf: introduce initial file I/O infrastructure")Pavel Begunkov (2):
dma-buf-io: fix typos in kernel docs
dma-buf-io: documentdma_buf_io_init_map[...]
Applied, thanks!
[1/2] dma-buf-io: fix typos in kernel docs
commit: 44e75dbecb19579db9a070ac8d5f7b400297c1ec
[2/2] dma-buf-io: document dma_buf_io_init_map
commit: aeef964d73dbfd7f477182bac934cdb4087d1724Best regards,
Signature · 1 line
Jens Axboe