#define __BACKPORT_SCATTERLIST_H
#include_next <linux/scatterlist.h>
+#if LINUX_VERSION_IS_LESS(3,7,0)
+int sg_nents(struct scatterlist *sg);
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
/*
#include <linux/pci.h>
#include <linux/pci_regs.h>
#include <linux/of.h>
+#include <linux/scatterlist.h>
bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
unsigned long delay)
EXPORT_SYMBOL_GPL(of_get_child_by_name);
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) */
#endif /* CONFIG_OF */
+
+int sg_nents(struct scatterlist *sg)
+{
+ int nents;
+ for (nents = 0; sg; sg = sg_next(sg))
+ nents++;
+ return nents;
+}
+EXPORT_SYMBOL_GPL(sg_nents);