summaryrefslogtreecommitdiff
path: root/backport
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2018-09-06 13:30:02 +0200
committerJohannes Berg <johannes.berg@intel.com>2018-09-10 08:55:06 +0200
commita28ba2a16e3905162f65427cbcf5cfe3e1f68b3c (patch)
tree3325ea7ef902fd5d54473ed4d01424ebeeece7be /backport
parent8910ef3c16910d63ade2ecf184cf01be487d70ea (diff)
backports: backport sg_init_marker()
It is used by new mt76 changes Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport')
-rw-r--r--backport/backport-include/linux/scatterlist.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/backport/backport-include/linux/scatterlist.h b/backport/backport-include/linux/scatterlist.h
index bfc74494..06934b6b 100644
--- a/backport/backport-include/linux/scatterlist.h
+++ b/backport/backport-include/linux/scatterlist.h
@@ -102,4 +102,27 @@ size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents,
#endif /* LINUX_VERSION_IS_LESS(3, 11, 0) */
+#if LINUX_VERSION_IS_LESS(4, 17, 0)
+
+#define sg_init_marker LINUX_BACKPORT(sg_init_marker)
+/**
+ * sg_init_marker - Initialize markers in sg table
+ * @sgl: The SG table
+ * @nents: Number of entries in table
+ *
+ **/
+static inline void sg_init_marker(struct scatterlist *sgl,
+ unsigned int nents)
+{
+#ifdef CONFIG_DEBUG_SG
+ unsigned int i;
+
+ for (i = 0; i < nents; i++)
+ sgl[i].sg_magic = SG_MAGIC;
+#endif
+ sg_mark_end(&sgl[nents - 1]);
+}
+
+#endif /* LINUX_VERSION_IS_LESS(4, 17, 0) */
+
#endif /* __BACKPORT_SCATTERLIST_H */