Core: Remove 'tfm_bitcount' referencing
Replace all 'tfm_bitcount' calling with 'tfm_is_one_bit_set'.
Change-Id: I6d7bc3d85f3cc31c7d0564a3f5104e4d60dc6597
Signed-off-by: Ken Liu <ken.liu@arm.com>
diff --git a/secure_fw/core/include/secure_utilities.h b/secure_fw/core/include/secure_utilities.h
index 98a191f..83dc402 100644
--- a/secure_fw/core/include/secure_utilities.h
+++ b/secure_fw/core/include/secure_utilities.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -19,8 +19,6 @@
#define ERROR_MSG(msg)
-int32_t tfm_bitcount(uint32_t n);
-
bool tfm_is_one_bit_set(uint32_t n);
#endif /* __SECURE_UTILITIES_H__ */
diff --git a/secure_fw/core/tfm_secure_api.c b/secure_fw/core/tfm_secure_api.c
index 2c49717..eecb62e 100644
--- a/secure_fw/core/tfm_secure_api.c
+++ b/secure_fw/core/tfm_secure_api.c
@@ -14,16 +14,6 @@
*/
int32_t tfm_secure_lock;
-int32_t tfm_bitcount(uint32_t n)
-{
- uint8_t count = 0;
- while (n) {
- count++;
- n &= n-1;
- }
- return (int32_t)count;
-}
-
bool tfm_is_one_bit_set(uint32_t n)
{
return ((n && !(n & (n-1))) ? true : false);
diff --git a/secure_fw/spm/spm_ipc.c b/secure_fw/spm/spm_ipc.c
index ea1f735..ea3fa36 100644
--- a/secure_fw/spm/spm_ipc.c
+++ b/secure_fw/spm/spm_ipc.c
@@ -925,7 +925,7 @@
* Only one message could be retrieved every time for psa_get(). It is a
* fatal error if the input signal has more than a signal bit set.
*/
- if (tfm_bitcount(signal) != 1) {
+ if (!tfm_is_one_bit_set(signal)) {
tfm_core_panic();
}