3c1b5801f5fd923fbd3eb621c0381ffa34b87aaf
[openwrt-packages.git] /
1 From: Cosmin Paraschiv <cosmin.paraschiv@freescale.com>
2 To: <cryptodev-linux-devel@gna.org>
3 Subject: [Cryptodev-linux-devel] [PATCH v2] Replace INIT_COMPLETION with
4         reinit_completion.
5
6 In the 3.13-rc1 Linux kernel, the INIT_COMPLETION macro has been replaced
7 with an inline function, reinit_completion [1][2]. We are currently
8 using the 3.13-rc3 Linux kernel, which leads to the following error:
9
10 cryptlib.c:279:2: error: implicit declaration of function 'INIT_COMPLETION' [-Werror=implicit-function-declaration]
11   INIT_COMPLETION(cdata->async.result->completion);
12
13 [1] https://github.com/torvalds/linux/commit/c32f74ab2872994bc8336ed367313da3139350ca
14 [2] https://github.com/torvalds/linux/commit/62026aedaacedbe1ffe94a3599ad4acd8ecdf587
15
16 Signed-off-by: Cosmin Paraschiv <cosmin.paraschiv@freescale.com>
17 Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
18 Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
19 Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
20 ---
21  cryptlib.c      | 8 ++++----
22  cryptodev_int.h | 6 ++++++
23  2 files changed, 10 insertions(+), 4 deletions(-)
24
25 diff --git a/cryptlib.c b/cryptlib.c
26 index e6c91fc..fe25563 100644
27 --- a/cryptlib.c
28 +++ b/cryptlib.c
29 @@ -276,7 +276,7 @@ ssize_t cryptodev_cipher_encrypt(struct cipher_data *cdata,
30  {
31         int ret;
32  
33 -       INIT_COMPLETION(cdata->async.result->completion);
34 +       reinit_completion(&cdata->async.result->completion);
35  
36         if (cdata->aead == 0) {
37                 ablkcipher_request_set_crypt(cdata->async.request,
38 @@ -299,7 +299,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
39  {
40         int ret;
41  
42 -       INIT_COMPLETION(cdata->async.result->completion);
43 +       reinit_completion(&cdata->async.result->completion);
44         if (cdata->aead == 0) {
45                 ablkcipher_request_set_crypt(cdata->async.request,
46                         (struct scatterlist *)src, dst,
47 @@ -410,7 +410,7 @@ ssize_t cryptodev_hash_update(struct hash_data *hdata,
48  {
49         int ret;
50  
51 -       INIT_COMPLETION(hdata->async.result->completion);
52 +       reinit_completion(&hdata->async.result->completion);
53         ahash_request_set_crypt(hdata->async.request, sg, NULL, len);
54  
55         ret = crypto_ahash_update(hdata->async.request);
56 @@ -422,7 +422,7 @@ int cryptodev_hash_final(struct hash_data *hdata, void* output)
57  {
58         int ret;
59  
60 -       INIT_COMPLETION(hdata->async.result->completion);
61 +       reinit_completion(&hdata->async.result->completion);
62         ahash_request_set_crypt(hdata->async.request, NULL, output, 0);
63  
64         ret = crypto_ahash_final(hdata->async.request);
65 diff --git a/cryptodev_int.h b/cryptodev_int.h
66 index eb2aabf..3834ef1 100644
67 --- a/cryptodev_int.h
68 +++ b/cryptodev_int.h
69 @@ -2,6 +2,12 @@
70  #ifndef CRYPTODEV_INT_H
71  # define CRYPTODEV_INT_H
72  
73 +#include <linux/version.h>
74 +
75 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0))
76 +#  define reinit_completion(x) INIT_COMPLETION(*(x))
77 +#endif
78 +
79  #include <linux/init.h>
80  #include <linux/sched.h>
81  #include <linux/fs.h>
82 -- 
83 1.8.3.1
git clone https://git.99rst.org/PROJECT