aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0103-zc-Use-the-power-of-elif.patch
blob: 5c121077525dd594bc3310d817bd2130208d6d4a (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
From e2fa367d968926500584912e98cf7b17bd9487a6 Mon Sep 17 00:00:00 2001
From: Phil Sutter <phil@nwl.cc>
Date: Thu, 9 Feb 2017 11:40:46 +0100
Subject: [PATCH 103/104] zc: Use the power of #elif

While here, get rid of that trailing newline as well.

Fixes: 2b29be8ac4141 ("adjust to API changes in kernel >=4.10")
Suggested-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 zc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/zc.c b/zc.c
index 2f4ea99..ae464ff 100644
--- a/zc.c
+++ b/zc.c
@@ -62,21 +62,17 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
 	ret = get_user_pages(task, mm,
 			(unsigned long)addr, pgcount, write, 0, pg, NULL);
-#else
-#  if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
+#elif (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))
+#elif (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
+#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)
@@ -222,4 +218,3 @@ int get_userbuf(struct csession *ses,
 	}
 	return 0;
 }
-
-- 
2.10.2