Skip to content

Commit f304c25

Browse files
ptesarikJonathan Corbet
authored andcommitted
docs: dma-api: clean up documentation of dma_map_sg()
Describe in one sentence what the function does. Do not repeat example situations when the returned number is lower than the number of segments on input. Signed-off-by: Petr Tesarik <[email protected]> Reviewed-by: Bagas Sanjaya <[email protected]> Tested-by: Randy Dunlap <[email protected]> Acked-by: Marek Szyprowski <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0ebbc69 commit f304c25

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Documentation/core-api/dma-api.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,10 @@ action (e.g. reduce current DMA mapping usage or delay and try again later).
322322
dma_map_sg(struct device *dev, struct scatterlist *sg,
323323
int nents, enum dma_data_direction direction)
324324

325-
Returns: the number of DMA address segments mapped (this may be shorter
326-
than <nents> passed in if some elements of the scatter/gather list are
327-
physically or virtually adjacent and an IOMMU maps them with a single
328-
entry).
325+
Maps a scatter/gather list for DMA. Returns the number of DMA address segments
326+
mapped, which may be smaller than <nents> passed in if several consecutive
327+
sglist entries are merged (e.g. with an IOMMU, or if some adjacent segments
328+
just happen to be physically contiguous).
329329

330330
Please note that the sg cannot be mapped again if it has been mapped once.
331331
The mapping process is allowed to destroy information in the sg.
@@ -349,9 +349,8 @@ With scatterlists, you use the resulting mapping like this::
349349
where nents is the number of entries in the sglist.
350350

351351
The implementation is free to merge several consecutive sglist entries
352-
into one (e.g. with an IOMMU, or if several pages just happen to be
353-
physically contiguous) and returns the actual number of sg entries it
354-
mapped them to. On failure 0, is returned.
352+
into one. The returned number is the actual number of sg entries it
353+
mapped them to. On failure, 0 is returned.
355354

356355
Then you should loop count times (note: this can be less than nents times)
357356
and use sg_dma_address() and sg_dma_len() macros where you previously

0 commit comments

Comments
 (0)