From 2a4b4b71ba8a14148708719077d80889faa6f47b Mon Sep 17 00:00:00 2001 From: Isla Mitchell Date: Tue, 11 Jul 2017 14:54:08 +0100 Subject: [PATCH] Fix order of #includes This fix modifies the order of system includes to meet the ARM TF coding standard. There are some exceptions in order to retain header groupings, minimise changes to imported headers, and where there are headers within the #if and #ifndef statements. Change-Id: I65085a142ba6a83792b26efb47df1329153f1624 Signed-off-by: Isla Mitchell --- bl1/aarch64/bl1_exceptions.S | 2 +- bl1/bl1_fwu.c | 2 +- bl1/bl1_main.c | 2 +- bl2u/bl2u_main.c | 2 +- bl31/bl31_main.c | 2 +- drivers/auth/cryptocell/cryptocell_crypto.c | 4 ++-- drivers/auth/mbedtls/mbedtls_crypto.c | 1 - drivers/auth/tbbr/tbbr_cot.c | 4 +++- drivers/partition/partition.c | 2 +- include/drivers/arm/cryptocell/cc_pal_types_plat.h | 2 +- include/drivers/arm/cryptocell/nvm.h | 2 +- include/drivers/auth/mbedtls/mbedtls_config.h | 6 +++--- include/lib/pmf/pmf_helpers.h | 2 +- lib/cpus/aarch64/cortex_a55.S | 2 +- lib/psci/psci_on.c | 2 +- lib/psci/psci_suspend.c | 4 ++-- lib/psci/psci_system_off.c | 2 +- services/spd/opteed/opteed_main.c | 5 +++-- services/spd/tlkd/tlkd_main.c | 2 +- services/spd/trusty/trusty.c | 4 ++-- services/spd/tspd/tspd_main.c | 2 +- tools/cert_create/include/ext.h | 2 +- tools/cert_create/src/cmd_opt.c | 2 +- tools/cert_create/src/main.c | 2 +- tools/cert_create/src/sha.c | 2 +- tools/fiptool/fiptool.c | 1 - tools/fiptool/fiptool.h | 3 ++- tools/fiptool/tbbr_config.c | 3 +-- 28 files changed, 36 insertions(+), 35 deletions(-) diff --git a/bl1/aarch64/bl1_exceptions.S b/bl1/aarch64/bl1_exceptions.S index b0902fd5a..eb98ffa0d 100644 --- a/bl1/aarch64/bl1_exceptions.S +++ b/bl1/aarch64/bl1_exceptions.S @@ -6,8 +6,8 @@ #include #include -#include #include +#include #include /* ----------------------------------------------------------------------------- diff --git a/bl1/bl1_fwu.c b/bl1/bl1_fwu.c index 8dfc55f6c..07a7fc814 100644 --- a/bl1/bl1_fwu.c +++ b/bl1/bl1_fwu.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include #include +#include #include #include #include diff --git a/bl1/bl1_main.c b/bl1/bl1_main.c index fa4f3a4c0..821b6a357 100644 --- a/bl1/bl1_main.c +++ b/bl1/bl1_main.c @@ -17,8 +17,8 @@ #include #include #include -#include "bl1_private.h" #include +#include "bl1_private.h" /* BL1 Service UUID */ DEFINE_SVC_UUID(bl1_svc_uid, diff --git a/bl2u/bl2u_main.c b/bl2u/bl2u_main.c index 820da100e..09ad4683f 100644 --- a/bl2u/bl2u_main.c +++ b/bl2u/bl2u_main.c @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c index c53f8a220..4a88bd7b5 100644 --- a/bl31/bl31_main.c +++ b/bl31/bl31_main.c @@ -7,8 +7,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/drivers/auth/cryptocell/cryptocell_crypto.c b/drivers/auth/cryptocell/cryptocell_crypto.c index 05462bea1..80c10933e 100644 --- a/drivers/auth/cryptocell/cryptocell_crypto.c +++ b/drivers/auth/cryptocell/cryptocell_crypto.c @@ -5,8 +5,8 @@ */ #include -#include #include +#include #include #include #include @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include #include diff --git a/drivers/auth/mbedtls/mbedtls_crypto.c b/drivers/auth/mbedtls/mbedtls_crypto.c index b157a32ed..d8810d6db 100644 --- a/drivers/auth/mbedtls/mbedtls_crypto.c +++ b/drivers/auth/mbedtls/mbedtls_crypto.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - #include #include #include diff --git a/drivers/auth/tbbr/tbbr_cot.c b/drivers/auth/tbbr/tbbr_cot.c index e88c7c26d..a9a4b37fe 100644 --- a/drivers/auth/tbbr/tbbr_cot.c +++ b/drivers/auth/tbbr/tbbr_cot.c @@ -6,12 +6,14 @@ #include #include +#include + #if USE_TBBR_DEFS #include #else #include #endif -#include + /* * Maximum key and hash sizes (in DER format) diff --git a/drivers/partition/partition.c b/drivers/partition/partition.c index 190ac38d9..e2b468363 100644 --- a/drivers/partition/partition.c +++ b/drivers/partition/partition.c @@ -6,8 +6,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/include/drivers/arm/cryptocell/cc_pal_types_plat.h b/include/drivers/arm/cryptocell/cc_pal_types_plat.h index d8ed3e1d3..84100245b 100644 --- a/include/drivers/arm/cryptocell/cc_pal_types_plat.h +++ b/include/drivers/arm/cryptocell/cc_pal_types_plat.h @@ -11,8 +11,8 @@ #define _CC_PAL_TYPES_PLAT_H /* Host specific types for standard (ISO-C99) compilant platforms */ -#include #include +#include typedef uint32_t CCStatus; diff --git a/include/drivers/arm/cryptocell/nvm.h b/include/drivers/arm/cryptocell/nvm.h index f806d3d42..a70289fb8 100644 --- a/include/drivers/arm/cryptocell/nvm.h +++ b/include/drivers/arm/cryptocell/nvm.h @@ -13,8 +13,8 @@ extern "C" #endif #include "cc_crypto_boot_defs.h" -#include "cc_sec_defs.h" #include "cc_pal_types.h" +#include "cc_sec_defs.h" /*------------------------------------ DEFINES diff --git a/include/drivers/auth/mbedtls/mbedtls_config.h b/include/drivers/auth/mbedtls/mbedtls_config.h index 0a0588626..fdeb52bb6 100644 --- a/include/drivers/auth/mbedtls/mbedtls_config.h +++ b/include/drivers/auth/mbedtls/mbedtls_config.h @@ -69,12 +69,12 @@ #define MBEDTLS_MPI_WINDOW_SIZE 2 #define MBEDTLS_MPI_MAX_SIZE 256 +/* System headers required to build mbed TLS with the current configuration */ +#include + /* Memory buffer allocator options */ #define MBEDTLS_MEMORY_ALIGN_MULTIPLE 8 #include "mbedtls/check_config.h" -/* System headers required to build mbed TLS with the current configuration */ -#include - #endif /* __MBEDTLS_CONFIG_H__ */ diff --git a/include/lib/pmf/pmf_helpers.h b/include/lib/pmf/pmf_helpers.h index 286262a4c..9984d6918 100644 --- a/include/lib/pmf/pmf_helpers.h +++ b/include/lib/pmf/pmf_helpers.h @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include /* * Prototype for PMF service functions. diff --git a/lib/cpus/aarch64/cortex_a55.S b/lib/cpus/aarch64/cortex_a55.S index f1031591a..741c77347 100644 --- a/lib/cpus/aarch64/cortex_a55.S +++ b/lib/cpus/aarch64/cortex_a55.S @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include #include #include #include +#include #include #include diff --git a/lib/psci/psci_on.c b/lib/psci/psci_on.c index d5c9843a4..16b22c2ab 100644 --- a/lib/psci/psci_on.c +++ b/lib/psci/psci_on.c @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include #include #include "psci_private.h" diff --git a/lib/psci/psci_suspend.c b/lib/psci/psci_suspend.c index 479889262..0d1589ee0 100644 --- a/lib/psci/psci_suspend.c +++ b/lib/psci/psci_suspend.c @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include #include #include +#include +#include #include #include #include diff --git a/lib/psci/psci_system_off.c b/lib/psci/psci_system_off.c index 4a55248db..ef5d3d1d6 100644 --- a/lib/psci/psci_system_off.c +++ b/lib/psci/psci_system_off.c @@ -4,12 +4,12 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include #include #include #include #include #include +#include #include "psci_private.h" void __dead2 psci_system_off(void) diff --git a/services/spd/opteed/opteed_main.c b/services/spd/opteed/opteed_main.c index 418e4820e..e2a20352a 100644 --- a/services/spd/opteed/opteed_main.c +++ b/services/spd/opteed/opteed_main.c @@ -16,8 +16,8 @@ ******************************************************************************/ #include #include -#include #include +#include #include #include #include @@ -26,8 +26,9 @@ #include #include #include "opteed_private.h" -#include "teesmc_opteed_macros.h" #include "teesmc_opteed.h" +#include "teesmc_opteed_macros.h" + /******************************************************************************* * Address of the entrypoint vector table in OPTEE. It is diff --git a/services/spd/tlkd/tlkd_main.c b/services/spd/tlkd/tlkd_main.c index 948be5df6..78e98535f 100644 --- a/services/spd/tlkd/tlkd_main.c +++ b/services/spd/tlkd/tlkd_main.c @@ -15,8 +15,8 @@ ******************************************************************************/ #include #include -#include #include +#include #include #include #include diff --git a/services/spd/trusty/trusty.c b/services/spd/trusty/trusty.c index a95141bff..e386f71c6 100644 --- a/services/spd/trusty/trusty.c +++ b/services/spd/trusty/trusty.c @@ -6,8 +6,8 @@ #include #include /* for context_mgmt.h */ -#include #include +#include #include #include #include @@ -15,8 +15,8 @@ #include #include -#include "smcall.h" #include "sm_err.h" +#include "smcall.h" /* macro to check if Hypervisor is enabled in the HCR_EL2 register */ #define HYP_ENABLE_FLAG 0x286001 diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c index afa7e2ae2..2ba9f84c0 100644 --- a/services/spd/tspd/tspd_main.c +++ b/services/spd/tspd/tspd_main.c @@ -16,8 +16,8 @@ ******************************************************************************/ #include #include -#include #include +#include #include #include #include diff --git a/tools/cert_create/include/ext.h b/tools/cert_create/include/ext.h index 2aa17e253..d432e639c 100644 --- a/tools/cert_create/include/ext.h +++ b/tools/cert_create/include/ext.h @@ -7,8 +7,8 @@ #ifndef EXT_H_ #define EXT_H_ -#include "key.h" #include +#include "key.h" /* Extension types supported */ enum ext_type_e { diff --git a/tools/cert_create/src/cmd_opt.c b/tools/cert_create/src/cmd_opt.c index 0d47872ec..64180d1f5 100644 --- a/tools/cert_create/src/cmd_opt.c +++ b/tools/cert_create/src/cmd_opt.c @@ -5,10 +5,10 @@ */ #include +#include #include #include #include -#include #include "debug.h" /* Command line options */ diff --git a/tools/cert_create/src/main.c b/tools/cert_create/src/main.c index 99236370c..f14601c8b 100644 --- a/tools/cert_create/src/main.c +++ b/tools/cert_create/src/main.c @@ -30,8 +30,8 @@ #include "ext.h" #include "key.h" #include "sha.h" -#include "tbbr/tbb_ext.h" #include "tbbr/tbb_cert.h" +#include "tbbr/tbb_ext.h" #include "tbbr/tbb_key.h" /* diff --git a/tools/cert_create/src/sha.c b/tools/cert_create/src/sha.c index 5d5e9e219..297159302 100644 --- a/tools/cert_create/src/sha.c +++ b/tools/cert_create/src/sha.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include #include +#include #include "debug.h" diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c index 4d80f2f16..65e4a25c4 100644 --- a/tools/fiptool/fiptool.c +++ b/tools/fiptool/fiptool.c @@ -19,7 +19,6 @@ #include #include - #include #include "fiptool.h" diff --git a/tools/fiptool/fiptool.h b/tools/fiptool/fiptool.h index 4b5cdd91f..889b0fde5 100644 --- a/tools/fiptool/fiptool.h +++ b/tools/fiptool/fiptool.h @@ -7,10 +7,11 @@ #ifndef __FIPTOOL_H__ #define __FIPTOOL_H__ +#include + #include #include -#include #include #define NELEM(x) (sizeof (x) / sizeof *(x)) diff --git a/tools/fiptool/tbbr_config.c b/tools/fiptool/tbbr_config.c index 7c6c24be4..6231cd4ed 100644 --- a/tools/fiptool/tbbr_config.c +++ b/tools/fiptool/tbbr_config.c @@ -4,9 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include - #include +#include #include "tbbr_config.h"