summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch
blob: 93d608b81d351e4f582e1ab53bc9ed81803c63fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@intel.com>

From 2b29be8ac41414ed19cb4f5d5626d9bd0d7b11a8 Mon Sep 17 00:00:00 2001
From: Cristian Stoica <cristian.stoica@nxp.com>
Date: Wed, 8 Feb 2017 12:11:04 +0200
Subject: [PATCH] adjust to API changes in kernel >=4.10

There are many changes related to get_user_pages and the code is rewritten
for clarity.

Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
---
 zc.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/zc.c b/zc.c
index e766ee3..2f4ea99 100644
--- a/zc.c
+++ b/zc.c
@@ -59,19 +59,25 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
 	}
 
 	down_read(&mm->mmap_sem);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
-	ret = get_user_pages_remote(
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
+	ret = get_user_pages(task, mm,
+			(unsigned long)addr, pgcount, write, 0, pg, NULL);
 #else
-	ret = get_user_pages(
-#endif
-			task, mm,
-			(unsigned long)addr, pgcount,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
-			write ? FOLL_WRITE : 0,
-#else
-			write, 0,
-#endif
+#  if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
+	ret = get_user_pages_remote(task, mm,
+			(unsigned long)addr, pgcount, write, 0, pg, NULL);
+#  else
+#    if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0))
+	ret = get_user_pages_remote(task, mm,
+			(unsigned long)addr, pgcount, write ? FOLL_WRITE : 0,
 			pg, NULL);
+#    else
+	ret = get_user_pages_remote(task, mm,
+			(unsigned long)addr, pgcount, write ? FOLL_WRITE : 0,
+			pg, NULL, NULL);
+#    endif
+#  endif
+#endif
 	up_read(&mm->mmap_sem);
 	if (ret != pgcount)
 		return -EINVAL;