Backports Archive on lore.kernel.org
 help / Atom feed
* [PATCH] backports: backport sg_init_marker()
@ 2018-09-06 11:30 Felix Fietkau
  0 siblings, 0 replies; 1+ messages in thread
From: Felix Fietkau @ 2018-09-06 11:30 UTC (permalink / raw)
  To: backports; +Cc: john

It is used by new mt76 changes

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/scatterlist.h | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

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 */
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06 11:30 [PATCH] backports: backport sg_init_marker() Felix Fietkau

Backports Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/backports/0 backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ https://lore.kernel.org/backports \
		backports@vger.kernel.org backports@archiver.kernel.org
	public-inbox-index backports


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.backports


AGPL code for this site: git clone https://public-inbox.org/ public-inbox