ARM platforms: Make arm_lock static
authorSandrine Bailleux <sandrine.bailleux@arm.com>
Wed, 11 Jul 2018 11:59:18 +0000 (13:59 +0200)
committerSandrine Bailleux <sandrine.bailleux@arm.com>
Wed, 11 Jul 2018 15:33:29 +0000 (17:33 +0200)
The ARM_INSTANTIATE_LOCK macro defines a lock meant to be further
manipulated using the arm_lock_init/get/release() macros. It has 2
variants, depending on the BL image it is compiled for. One version
defines the lock variable with internal linkage whereas the other one,
with external linkage.

Code that uses these macros is not compliant with MISRA rule 8.4 because
when using the external linkage version, there is no visible declaration
for the lock variable.

This patch defines the arm_lock variable with internal linkage in both
cases. This fits well the way these macros are used in the code today,
where the lock is not used outside of the translation unit it is
defined in.

Change-Id: I213a74a2a6088a4f1e9a61a319ca7579c2001320
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
include/plat/arm/common/plat_arm.h

index 33f2c7dbef447a1bcb82511bbe94de47bae24fb2..2d406308ac56a0c9802507e9f3dd037826d11702 100644 (file)
@@ -86,7 +86,7 @@ void arm_setup_page_tables(uintptr_t total_base,
  * Use this macro to instantiate lock before it is used in below
  * arm_lock_xxx() macros
  */
-#define ARM_INSTANTIATE_LOCK   DEFINE_BAKERY_LOCK(arm_lock)
+#define ARM_INSTANTIATE_LOCK   static DEFINE_BAKERY_LOCK(arm_lock)
 #define ARM_LOCK_GET_INSTANCE  (&arm_lock)
 /*
  * These are wrapper macros to the Coherent Memory Bakery Lock API.