summaryrefslogtreecommitdiffstats
path: root/driver/compat.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2017-06-14 03:33:43 +0200
committerSuren A. Chilingaryan <csa@suren.me>2017-06-14 03:33:43 +0200
commita92e1d1a8d9a4dcaff3c6dc3d6b47d4b2e341155 (patch)
treed94fb21e165f7a10cbdebbaebb81d68991294464 /driver/compat.h
parent4b969ccd377f8cc643738135efacebe6761a1068 (diff)
downloadpcitool-a92e1d1a8d9a4dcaff3c6dc3d6b47d4b2e341155.tar.gz
pcitool-a92e1d1a8d9a4dcaff3c6dc3d6b47d4b2e341155.tar.bz2
pcitool-a92e1d1a8d9a4dcaff3c6dc3d6b47d4b2e341155.tar.xz
pcitool-a92e1d1a8d9a4dcaff3c6dc3d6b47d4b2e341155.zip
Support kernels up to 4.9 (patch provided by Timo)
Diffstat (limited to 'driver/compat.h')
-rw-r--r--driver/compat.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/driver/compat.h b/driver/compat.h
index 24cc5a9..ba9d15a 100644
--- a/driver/compat.h
+++ b/driver/compat.h
@@ -37,4 +37,13 @@
# define __devinitdata
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
+# define get_user_pages_compat(vma, nr, pages) get_user_pages(vma, nr, FOLL_WRITE, pages, NULL)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
+# define get_user_pages_compat(vma, nr, pages) get_user_pages(vma, nr, 1, 0, pages, NULL)
+#else
+# define get_user_pages_compat(vma, nr, pages) get_user_pages(current, current->mm, vma, nr, 1, 0, pages, NULL)
+#endif
+
+
#endif