xref: /linux/drivers/crypto/intel/qat/qat_common/adf_module.c (revision b2128290c29902315e632ea59e0504d6bc9e9b42)
1 // SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
2 /* Copyright(c) 2014 - 2020 Intel Corporation */
3 
4 #include <crypto/algapi.h>
5 #include <linux/errno.h>
6 #include <linux/module.h>
7 
8 #include "adf_common_drv.h"
9 
10 static int __init adf_register_module(void)
11 {
12 	if (adf_init_misc_wq())
13 		goto err_misc_wq;
14 
15 	if (adf_init_aer())
16 		goto err_aer;
17 
18 	if (adf_init_pf_wq())
19 		goto err_pf_wq;
20 
21 	if (adf_init_vf_wq())
22 		goto err_vf_wq;
23 
24 	if (qat_crypto_register())
25 		goto err_crypto_register;
26 
27 	if (qat_compression_register())
28 		goto err_compression_register;
29 
30 	return 0;
31 
32 err_compression_register:
33 	qat_crypto_unregister();
34 err_crypto_register:
35 	adf_exit_vf_wq();
36 err_vf_wq:
37 	adf_exit_pf_wq();
38 err_pf_wq:
39 	adf_exit_aer();
40 err_aer:
41 	adf_exit_misc_wq();
42 err_misc_wq:
43 	return -EFAULT;
44 }
45 
46 static void __exit adf_unregister_module(void)
47 {
48 	adf_exit_misc_wq();
49 	adf_exit_aer();
50 	adf_exit_vf_wq();
51 	adf_exit_pf_wq();
52 	qat_crypto_unregister();
53 	qat_compression_unregister();
54 	adf_clean_vf_map(false);
55 }
56 
57 module_init(adf_register_module);
58 module_exit(adf_unregister_module);
59 MODULE_LICENSE("Dual BSD/GPL");
60 MODULE_AUTHOR("Intel");
61 MODULE_DESCRIPTION("Intel(R) QuickAssist Technology");
62 MODULE_ALIAS_CRYPTO("intel_qat");
63 MODULE_IMPORT_NS("CRYPTO_INTERNAL");
64