git: 82b4e784f3df - stable/13 - linuxkpi: Add sg_init_one

From: Alex Richardson <arichardson_at_FreeBSD.org>
Date: Sat, 07 May 2022 15:57:12 UTC
The branch stable/13 has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=82b4e784f3dfd3b47d1225345bafdfddeeaea01b

commit 82b4e784f3dfd3b47d1225345bafdfddeeaea01b
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-10-08 08:32:46 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2022-05-07 11:57:31 +0000

    linuxkpi: Add sg_init_one
    
    Needed for the virtio-gpu driver.
    
    Reviewed By:    #linuxkpi, manu, bz, hselasky
    Differential Revision: https://reviews.freebsd.org/D32366
    
    (cherry picked from commit 2686b10db41c79dd1a0a0c33a7e0c0b67e0701cc)
---
 sys/compat/linuxkpi/common/include/linux/scatterlist.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
index d51c45853945..a3da30e1b9a7 100644
--- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h
+++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
@@ -188,6 +188,13 @@ sg_init_table(struct scatterlist *sg, unsigned int nents)
 	sg_mark_end(&sg[nents - 1]);
 }
 
+static inline void
+sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen)
+{
+	sg_init_table(sg, 1);
+	sg_set_buf(sg, buf, buflen);
+}
+
 static struct scatterlist *
 sg_kmalloc(unsigned int nents, gfp_t gfp_mask)
 {