]> www.infradead.org Git - users/willy/xarray.git/commitdiff
docs: dma-api: clean up documentation of dma_map_sg()
authorPetr Tesarik <ptesarik@suse.com>
Fri, 27 Jun 2025 10:10:15 +0000 (12:10 +0200)
committerJonathan Corbet <corbet@lwn.net>
Tue, 1 Jul 2025 19:56:05 +0000 (13:56 -0600)
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 <ptesarik@suse.com>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250627101015.1600042-9-ptesarik@suse.com
Documentation/core-api/dma-api.rst

index c1ba2a967dbfba0ba12a28e26b1409f28d723ef8..3087bea715ed200a5086dc256ae1d0a02448294a 100644 (file)
@@ -322,10 +322,10 @@ action (e.g. reduce current DMA mapping usage or delay and try again later).
        dma_map_sg(struct device *dev, struct scatterlist *sg,
                   int nents, enum dma_data_direction direction)
 
-Returns: the number of DMA address segments mapped (this may be shorter
-than <nents> passed in if some elements of the scatter/gather list are
-physically or virtually adjacent and an IOMMU maps them with a single
-entry).
+Maps a scatter/gather list for DMA. Returns the number of DMA address segments
+mapped, which may be smaller than <nents> passed in if several consecutive
+sglist entries are merged (e.g. with an IOMMU, or if some adjacent segments
+just happen to be physically contiguous).
 
 Please note that the sg cannot be mapped again if it has been mapped once.
 The mapping process is allowed to destroy information in the sg.
@@ -349,9 +349,8 @@ With scatterlists, you use the resulting mapping like this::
 where nents is the number of entries in the sglist.
 
 The implementation is free to merge several consecutive sglist entries
-into one (e.g. with an IOMMU, or if several pages just happen to be
-physically contiguous) and returns the actual number of sg entries it
-mapped them to. On failure 0, is returned.
+into one.  The returned number is the actual number of sg entries it
+mapped them to. On failure, 0 is returned.
 
 Then you should loop count times (note: this can be less than nents times)
 and use sg_dma_address() and sg_dma_len() macros where you previously