You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.8 KiB

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