From d1e97dbd394a2a4f1c00cd001f81a08340c33070 Mon Sep 17 00:00:00 2001 From: Wenkai Lin Date: Sun, 24 Apr 2022 09:54:26 +0800 Subject: [PATCH 124/183] uadk: fix problems with referencing header files 1.includes are not sorted properly. Order-ref: standard library headers, OS library headers, and project-specific headers. 2.Header file is not self contained. 3.Include file is redundant, should be removed. Signed-off-by: Wenkai Lin --- drv/hisi_hpre.c | 1 - include/drv/wd_aead_drv.h | 5 +++-- include/drv/wd_cipher_drv.h | 4 +++- include/drv/wd_comp_drv.h | 3 +++ include/drv/wd_dh_drv.h | 2 ++ include/drv/wd_digest_drv.h | 5 +++-- include/drv/wd_ecc_drv.h | 5 ++++- include/hisi_qm_udrv.h | 2 +- include/uacce.h | 1 - include/wd.h | 1 + include/wd_aead.h | 4 ++-- include/wd_alg_common.h | 1 - include/wd_comp.h | 2 -- include/wd_digest.h | 2 +- include/wd_ecc.h | 2 -- include/wd_util.h | 1 + v1/drv/hisi_hpre_udrv.c | 2 +- v1/drv/hisi_qm_udrv.c | 4 ++-- v1/drv/hisi_rng_udrv.c | 2 +- v1/drv/hisi_sec_udrv.c | 2 +- v1/drv/hisi_zip_udrv.c | 2 +- v1/wd.c | 4 +--- v1/wd.h | 1 - v1/wd_adapter.c | 4 ++-- v1/wd_adapter.h | 4 ---- v1/wd_aead.c | 3 --- v1/wd_bmm.c | 1 - v1/wd_bmm.h | 3 +++ v1/wd_cipher.c | 5 +---- v1/wd_comp.c | 3 --- v1/wd_dh.c | 3 --- v1/wd_digest.c | 3 --- v1/wd_ecc.c | 3 --- v1/wd_rng.c | 5 +---- v1/wd_rsa.c | 5 +---- v1/wd_sgl.c | 1 - v1/wd_sgl.h | 4 ++++ v1/wd_util.h | 3 +-- wd.c | 2 +- wd_aead.c | 2 +- wd_cipher.c | 2 +- wd_comp.c | 2 +- wd_dh.c | 2 +- wd_digest.c | 2 +- wd_ecc.c | 2 +- wd_util.c | 2 +- 46 files changed, 52 insertions(+), 72 deletions(-) diff --git a/drv/hisi_hpre.c b/drv/hisi_hpre.c index 2a15900..bf0f440 100644 --- a/drv/hisi_hpre.c +++ b/drv/hisi_hpre.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/include/drv/wd_aead_drv.h b/include/drv/wd_aead_drv.h index 6d883bf..cc28ed5 100644 --- a/include/drv/wd_aead_drv.h +++ b/include/drv/wd_aead_drv.h @@ -4,8 +4,9 @@ #ifndef __WD_AEAD_DRV_H #define __WD_AEAD_DRV_H -#include "include/wd_alg_common.h" -#include "include/wd_aead.h" +#include "../wd_common.h" +#include "../wd_alg_common.h" +#include "../wd_aead.h" #ifdef __cplusplus extern "C" { diff --git a/include/drv/wd_cipher_drv.h b/include/drv/wd_cipher_drv.h index ecd421d..0ec758d 100644 --- a/include/drv/wd_cipher_drv.h +++ b/include/drv/wd_cipher_drv.h @@ -4,8 +4,10 @@ #ifndef __WD_CIPHER_DRV_H #define __WD_CIPHER_DRV_H -#include "../wd_cipher.h" +#include +#include "../wd_common.h" #include "../wd_alg_common.h" +#include "../wd_cipher.h" #ifdef __cplusplus extern "C" { diff --git a/include/drv/wd_comp_drv.h b/include/drv/wd_comp_drv.h index a6c93d0..0913ed6 100644 --- a/include/drv/wd_comp_drv.h +++ b/include/drv/wd_comp_drv.h @@ -5,6 +5,9 @@ #define __WD_COMP_DRV_H #include +#include +#include "../wd_common.h" +#include "../wd_alg_common.h" #include "../wd_comp.h" #ifdef __cplusplus diff --git a/include/drv/wd_dh_drv.h b/include/drv/wd_dh_drv.h index f0235c7..192e7d8 100644 --- a/include/drv/wd_dh_drv.h +++ b/include/drv/wd_dh_drv.h @@ -4,6 +4,8 @@ #ifndef __WD_DH_DRV_H #define __WD_DH_DRV_H +#include +#include "../wd_alg_common.h" #include "../wd_dh.h" #ifdef __cplusplus diff --git a/include/drv/wd_digest_drv.h b/include/drv/wd_digest_drv.h index 2401728..b426ab2 100644 --- a/include/drv/wd_digest_drv.h +++ b/include/drv/wd_digest_drv.h @@ -3,8 +3,9 @@ #ifndef __WD_DIGEST_DRV_H #define __WD_DIGEST_DRV_H -#include "include/wd_digest.h" -#include "include/wd_alg_common.h" +#include "../wd_common.h" +#include "../wd_alg_common.h" +#include "../wd_digest.h" #ifdef __cplusplus extern "C" { diff --git a/include/drv/wd_ecc_drv.h b/include/drv/wd_ecc_drv.h index 74dbcf8..ca21759 100644 --- a/include/drv/wd_ecc_drv.h +++ b/include/drv/wd_ecc_drv.h @@ -4,8 +4,11 @@ #ifndef __WD_ECC_DRV_H #define __WD_ECC_DRV_H +#include +#include + +#include "../wd.h" #include "../wd_ecc.h" -#include "../wd_alg_common.h" #ifdef __cplusplus extern "C" { diff --git a/include/hisi_qm_udrv.h b/include/hisi_qm_udrv.h index 2395fd7..ea5807e 100644 --- a/include/hisi_qm_udrv.h +++ b/include/hisi_qm_udrv.h @@ -4,9 +4,9 @@ #ifndef __HZIP_DRV_H__ #define __HZIP_DRV_H__ -#include #include #include +#include #include "config.h" #include "wd.h" diff --git a/include/uacce.h b/include/uacce.h index 07e36fe..fb3fb22 100644 --- a/include/uacce.h +++ b/include/uacce.h @@ -7,7 +7,6 @@ #ifndef _UAPIUUACCE_H #define _UAPIUUACCE_H -#include #include #ifdef __cplusplus diff --git a/include/wd.h b/include/wd.h index 273cbb8..56c4109 100644 --- a/include/wd.h +++ b/include/wd.h @@ -12,6 +12,7 @@ #include #include #include +#include #include "uacce.h" #ifdef __cplusplus diff --git a/include/wd_aead.h b/include/wd_aead.h index 3840062..3be8e8a 100644 --- a/include/wd_aead.h +++ b/include/wd_aead.h @@ -8,11 +8,11 @@ #define __WD_AEAD_H #include -#include "wd_alg_common.h" #include "config.h" +#include "wd.h" +#include "wd_alg_common.h" #include "wd_cipher.h" #include "wd_digest.h" -#include "wd.h" #ifdef __cplusplus extern "C" { diff --git a/include/wd_alg_common.h b/include/wd_alg_common.h index 30d244f..855f71d 100644 --- a/include/wd_alg_common.h +++ b/include/wd_alg_common.h @@ -7,7 +7,6 @@ #ifndef WD_ALG_COMMON_H #define WD_ALG_COMMON_H -#include #include #include #include "wd.h" diff --git a/include/wd_comp.h b/include/wd_comp.h index 5688b8b..e043a83 100644 --- a/include/wd_comp.h +++ b/include/wd_comp.h @@ -7,8 +7,6 @@ #ifndef __WD_COMP_H #define __WD_COMP_H -#include - #include "wd.h" #include "wd_alg_common.h" diff --git a/include/wd_digest.h b/include/wd_digest.h index 92b9a4f..e1a33cd 100644 --- a/include/wd_digest.h +++ b/include/wd_digest.h @@ -8,8 +8,8 @@ #define __WD_DIGEST_H #include -#include "wd_alg_common.h" #include "wd.h" +#include "wd_alg_common.h" #ifdef __cplusplus extern "C" { diff --git a/include/wd_ecc.h b/include/wd_ecc.h index 5aaec23..05a776d 100644 --- a/include/wd_ecc.h +++ b/include/wd_ecc.h @@ -7,10 +7,8 @@ #ifndef __WD_ECC_H #define __WD_ECC_H -#include #include #include -#include #include "wd.h" #include "wd_alg_common.h" diff --git a/include/wd_util.h b/include/wd_util.h index 7fe3d72..1243428 100644 --- a/include/wd_util.h +++ b/include/wd_util.h @@ -8,6 +8,7 @@ #define __WD_UTIL_H #include +#include #include "wd_alg_common.h" #ifdef __cplusplus diff --git a/v1/drv/hisi_hpre_udrv.c b/v1/drv/hisi_hpre_udrv.c index 3d8a00f..76ba3e8 100644 --- a/v1/drv/hisi_hpre_udrv.c +++ b/v1/drv/hisi_hpre_udrv.c @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "config.h" #include #include #include @@ -28,6 +27,7 @@ #include #include #include +#include "config.h" #include "v1/wd_util.h" #include "hisi_hpre_udrv.h" diff --git a/v1/drv/hisi_qm_udrv.c b/v1/drv/hisi_qm_udrv.c index b457efd..54aa016 100644 --- a/v1/drv/hisi_qm_udrv.c +++ b/v1/drv/hisi_qm_udrv.c @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "config.h" #include #include #include @@ -29,10 +28,11 @@ #include #include -#include "v1/drv/hisi_qm_udrv.h" +#include "config.h" #include "v1/drv/hisi_zip_udrv.h" #include "v1/drv/hisi_hpre_udrv.h" #include "v1/drv/hisi_sec_udrv.h" +#include "v1/drv/hisi_qm_udrv.h" #define HISI_SGL_SGE_NUM_MAX 255 #define HISI_SGL_ALIGN_SZ 64 diff --git a/v1/drv/hisi_rng_udrv.c b/v1/drv/hisi_rng_udrv.c index d051a25..a66bca5 100644 --- a/v1/drv/hisi_rng_udrv.c +++ b/v1/drv/hisi_rng_udrv.c @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "config.h" #include #include #include @@ -30,6 +29,7 @@ #include #include +#include "config.h" #include "hisi_rng_udrv.h" #define HISI_RNG_BYTES 4 diff --git a/v1/drv/hisi_sec_udrv.c b/v1/drv/hisi_sec_udrv.c index 3e1e7d1..0e8bf57 100644 --- a/v1/drv/hisi_sec_udrv.c +++ b/v1/drv/hisi_sec_udrv.c @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "config.h" #include #include #include @@ -29,6 +28,7 @@ #include #include +#include "config.h" #include "hisi_sec_udrv.h" #define DES_KEY_SIZE 8 diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index f59c08f..1dec4d6 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "config.h" #include #include #include @@ -28,6 +27,7 @@ #include #include #include +#include "config.h" #include "v1/wd_util.h" #include "v1/wd_comp.h" #include "v1/wd_cipher.h" diff --git a/v1/wd.c b/v1/wd.c index b94ec43..8e3a91c 100644 --- a/v1/wd.c +++ b/v1/wd.c @@ -18,20 +18,18 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include -#include "v1/wd.h" #include "v1/wd_util.h" #include "v1/wd_adapter.h" +#include "v1/wd.h" #define SYS_CLASS_DIR "/sys/class" #define LINUX_DEV_DIR "/dev" diff --git a/v1/wd.h b/v1/wd.h index 429c6b6..1bd9669 100644 --- a/v1/wd.h +++ b/v1/wd.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/v1/wd_adapter.c b/v1/wd_adapter.c index e53c561..53bf41e 100644 --- a/v1/wd_adapter.c +++ b/v1/wd_adapter.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "config.h" #include #include #include +#include "config.h" #include "v1/wd_util.h" -#include "v1/wd_adapter.h" #include "v1/drv/dummy_drv.h" #include "v1/drv/hisi_qm_udrv.h" #include "v1/drv/hisi_rng_udrv.h" +#include "v1/wd_adapter.h" #define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) diff --git a/v1/wd_adapter.h b/v1/wd_adapter.h index a5edd24..bcceff2 100644 --- a/v1/wd_adapter.h +++ b/v1/wd_adapter.h @@ -21,11 +21,7 @@ #include #include #include -#include #include -#include -#include -#include #include #include "wd.h" diff --git a/v1/wd_aead.c b/v1/wd_aead.c index cf358bf..d66f6e0 100644 --- a/v1/wd_aead.c +++ b/v1/wd_aead.c @@ -17,12 +17,9 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" diff --git a/v1/wd_bmm.c b/v1/wd_bmm.c index 11f2ee8..8f41997 100644 --- a/v1/wd_bmm.c +++ b/v1/wd_bmm.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/v1/wd_bmm.h b/v1/wd_bmm.h index 22ba702..88a8f9d 100644 --- a/v1/wd_bmm.h +++ b/v1/wd_bmm.h @@ -17,6 +17,9 @@ #ifndef _WD_BMM_H #define _WD_BMM_H +#include +#include "wd.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/v1/wd_cipher.c b/v1/wd_cipher.c index 8eb6a6f..355d9aa 100644 --- a/v1/wd_cipher.c +++ b/v1/wd_cipher.c @@ -17,17 +17,14 @@ #include #include #include -#include #include #include -#include -#include #include #include "v1/wd.h" -#include "v1/wd_cipher.h" #include "v1/wd_util.h" +#include "v1/wd_cipher.h" #define MAX_CIPHER_KEY_SIZE 64 #define MAX_CIPHER_RETRY_CNT 20000000 diff --git a/v1/wd_comp.c b/v1/wd_comp.c index 4ce79bd..7debef7 100644 --- a/v1/wd_comp.c +++ b/v1/wd_comp.c @@ -17,11 +17,8 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" #include "wd_util.h" diff --git a/v1/wd_dh.c b/v1/wd_dh.c index 66f1081..d11d5cd 100644 --- a/v1/wd_dh.c +++ b/v1/wd_dh.c @@ -17,12 +17,9 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" diff --git a/v1/wd_digest.c b/v1/wd_digest.c index 5acb660..71e5747 100644 --- a/v1/wd_digest.c +++ b/v1/wd_digest.c @@ -17,12 +17,9 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" diff --git a/v1/wd_ecc.c b/v1/wd_ecc.c index e2837bd..dfa5192 100644 --- a/v1/wd_ecc.c +++ b/v1/wd_ecc.c @@ -17,12 +17,9 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" diff --git a/v1/wd_rng.c b/v1/wd_rng.c index 4f6c114..d9d420e 100644 --- a/v1/wd_rng.c +++ b/v1/wd_rng.c @@ -17,17 +17,14 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" -#include "wd_rng.h" #include "wd_util.h" +#include "wd_rng.h" #define MAX_NUM 10 #define RNG_RESEND_CNT 8 diff --git a/v1/wd_rsa.c b/v1/wd_rsa.c index 11635df..4de249f 100644 --- a/v1/wd_rsa.c +++ b/v1/wd_rsa.c @@ -17,17 +17,14 @@ #include #include #include -#include #include #include -#include -#include #include #include "wd.h" -#include "wd_rsa.h" #include "wd_util.h" +#include "wd_rsa.h" #define RSA_BALANCE_THRHD 1280 #define RSA_RESEND_CNT 8 diff --git a/v1/wd_sgl.c b/v1/wd_sgl.c index 9995d69..9bdbe92 100644 --- a/v1/wd_sgl.c +++ b/v1/wd_sgl.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "wd.h" #include "wd_adapter.h" diff --git a/v1/wd_sgl.h b/v1/wd_sgl.h index c923677..e2e82f2 100644 --- a/v1/wd_sgl.h +++ b/v1/wd_sgl.h @@ -17,6 +17,10 @@ #ifndef _WD_SGL_H #define _WD_SGL_H +#include +#include +#include "wd.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/v1/wd_util.h b/v1/wd_util.h index 78b91ee..d1642f8 100644 --- a/v1/wd_util.h +++ b/v1/wd_util.h @@ -24,13 +24,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include "v1/wd.h" #include "v1/wd_ecc.h" @@ -88,7 +88,6 @@ #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#define offsetof(t, m) ((size_t)(uintptr_t)&((t *)0)->m) struct wd_lock { __u8 lock; diff --git a/wd.c b/wd.c index 0774837..3ce9c1e 100644 --- a/wd.c +++ b/wd.c @@ -17,8 +17,8 @@ #include #include -#include "wd.h" #include "wd_alg_common.h" +#include "wd.h" #define SYS_CLASS_DIR "/sys/class/uacce" diff --git a/wd_aead.c b/wd_aead.c index 2e006c3..36ca842 100644 --- a/wd_aead.c +++ b/wd_aead.c @@ -6,9 +6,9 @@ #include #include -#include "wd_aead.h" #include "wd_util.h" #include "include/drv/wd_aead_drv.h" +#include "wd_aead.h" #define XTS_MODE_KEY_DIVISOR 2 #define SM4_KEY_SIZE 16 diff --git a/wd_cipher.c b/wd_cipher.c index 6cf1377..43e83b7 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -7,9 +7,9 @@ #include #include #include -#include "wd_cipher.h" #include "wd_util.h" #include "include/drv/wd_cipher_drv.h" +#include "wd_cipher.h" #define XTS_MODE_KEY_DIVISOR 2 #define SM4_KEY_SIZE 16 diff --git a/wd_comp.c b/wd_comp.c index 3bd7f43..cc8f192 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -14,8 +14,8 @@ #include "config.h" #include "drv/wd_comp_drv.h" -#include "wd_comp.h" #include "wd_util.h" +#include "wd_comp.h" #define WD_POOL_MAX_ENTRIES 1024 #define MAX_RETRY_COUNTS 200000000 diff --git a/wd_dh.c b/wd_dh.c index aaea812..c16701d 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -14,8 +14,8 @@ #include "config.h" #include "include/drv/wd_dh_drv.h" -#include "wd_dh.h" #include "wd_util.h" +#include "wd_dh.h" #define WD_POOL_MAX_ENTRIES 1024 #define DH_BALANCE_THRHD 1280 diff --git a/wd_digest.c b/wd_digest.c index 7afbd9c..d5602ef 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -6,9 +6,9 @@ #include #include -#include "wd_digest.h" #include "wd_util.h" #include "include/drv/wd_digest_drv.h" +#include "wd_digest.h" #define XTS_MODE_KEY_DIVISOR 2 #define SM4_KEY_SIZE 16 diff --git a/wd_ecc.c b/wd_ecc.c index 671b62d..9005103 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -12,10 +12,10 @@ #include #include -#include "wd_ecc.h" #include "wd_util.h" #include "include/drv/wd_ecc_drv.h" #include "include/wd_ecc_curve.h" +#include "wd_ecc.h" #define WD_POOL_MAX_ENTRIES 1024 #define WD_ECC_CTX_MSG_NUM 64 diff --git a/wd_util.c b/wd_util.c index 57dafa7..43cedc6 100644 --- a/wd_util.c +++ b/wd_util.c @@ -12,8 +12,8 @@ #include #include #include "wd_alg_common.h" -#include "wd_util.h" #include "wd_sched.h" +#include "wd_util.h" #define WD_ASYNC_DEF_POLL_NUM 1 #define WD_ASYNC_DEF_QUEUE_DEPTH 1024 -- 2.27.0