git: 4370e9f1cfce - main - linuxkpi: Add for_each_sgtable_{sg,page}

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 18 Aug 2022 09:10:01 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=4370e9f1cfce6f43f170790be96b79f3da70be13

commit 4370e9f1cfce6f43f170790be96b79f3da70be13
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-08-09 08:54:19 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-08-18 07:46:22 +0000

    linuxkpi: Add for_each_sgtable_{sg,page}
    
    Needed by drm-kmod.
    
    Reviewed by:    bz
    Obtained from:  drm-kmod
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D36098
---
 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 a3da30e1b9a7..86aeefafb501 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_sg(sgt, sg, i) \
+	for_each_sg((sgt)->sgl, sg, (sgt)->orig_nents, i)
+
+#define	for_each_sgtable_page(sgt, iter, pgoffset) \
+	for_each_sg_page((sgt)->sgl, iter, (sgt)->orig_nents, pgoffset)
+
 #define	for_each_sgtable_dma_sg(sgt, sg, iter)				\
 	for_each_sg((sgt)->sgl, sg, (sgt)->nents, iter)