git: 1aca8a6ec61c - main - linuxkpi: Add for_each_sgtable_dma_sg and for_each_sgtable_dma_page
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 29 Mar 2022 11:19:37 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=1aca8a6ec61cce1a4673a8f7b5412b106e366aff
commit 1aca8a6ec61cce1a4673a8f7b5412b106e366aff
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-03-29 11:02:25 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-03-29 11:19:32 +0000
linuxkpi: Add for_each_sgtable_dma_sg and for_each_sgtable_dma_page
Variants of for_each_sg/for_each_sg_dma_page but they operate on sgtable
structs.
Needed by drm v5.10
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
---
sys/compat/linuxkpi/common/include/linux/scatterlist.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
index a302eb87ff0a..a3da30e1b9a7 100644
--- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h
+++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
@@ -99,6 +99,12 @@ struct sg_dma_page_iter {
#define for_each_sg(sglist, sg, sgmax, iter) \
for (iter = 0, sg = (sglist); iter < (sgmax); iter++, sg = sg_next(sg))
+#define for_each_sgtable_dma_sg(sgt, sg, iter) \
+ for_each_sg((sgt)->sgl, sg, (sgt)->nents, iter)
+
+#define for_each_sgtable_dma_page(sgt, iter, pgoffset) \
+ for_each_sg_dma_page((sgt)->sgl, iter, (sgt)->nents, pgoffset)
+
typedef struct scatterlist *(sg_alloc_fn) (unsigned int, gfp_t);
typedef void (sg_free_fn) (struct scatterlist *, unsigned int);