summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2026-01-08 13:50:12 +0300
committerVinod Koul <vkoul@kernel.org>2026-01-09 06:06:00 +0300
commit80c70bfb95cdbe0c644070f4ca4754a60f0a4830 (patch)
tree79398b6fe665c89718f850cbfecef15e12bb7083 /include
parentfe7b87d908da33326fbf6fe2b3830426432ec66c (diff)
downloadlinux-80c70bfb95cdbe0c644070f4ca4754a60f0a4830.tar.xz
scatterlist: introduce sg_nents_for_dma() helper
Sometimes the user needs to split each entry on the mapped scatter list due to DMA length constrains. This helper returns a number of entities assuming that each of them is not bigger than supplied maximum length. Reviewed-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20260108105619.3513561-2-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/scatterlist.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 29f6ceb98d74..6de1a2434299 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -441,6 +441,8 @@ static inline void sg_init_marker(struct scatterlist *sgl,
int sg_nents(struct scatterlist *sg);
int sg_nents_for_len(struct scatterlist *sg, u64 len);
+int sg_nents_for_dma(struct scatterlist *sgl, unsigned int sglen, size_t len);
+
struct scatterlist *sg_last(struct scatterlist *s, unsigned int);
void sg_init_table(struct scatterlist *, unsigned int);
void sg_init_one(struct scatterlist *, const void *, unsigned int);