EHF: MISRA fixes
These changes address most of the required MISRA rules. In the process,
some from generic code are also fixed.
No functional changes.
Change-Id: I19786070af7bc5e1f6d15bdba93e22a4451d8fe9
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
diff --git a/include/bl31/ehf.h b/include/bl31/ehf.h
index f963f8d..1446279 100644
--- a/include/bl31/ehf.h
+++ b/include/bl31/ehf.h
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef __EHF_H__
-#define __EHF_H__
+#ifndef EHF_H
+#define EHF_H
#ifndef __ASSEMBLY__
@@ -13,27 +13,27 @@
#include <utils_def.h>
/* Valid priorities set bit 0 of the priority handler. */
-#define _EHF_PRI_VALID (((uintptr_t) 1) << 0)
+#define EHF_PRI_VALID_ (((uintptr_t) 1) << 0)
/* Marker for no handler registered for a valid priority */
-#define _EHF_NO_HANDLER (0 | _EHF_PRI_VALID)
+#define EHF_NO_HANDLER_ (0U | EHF_PRI_VALID_)
/* Extract the specified number of top bits from 7 lower bits of priority */
#define EHF_PRI_TO_IDX(pri, plat_bits) \
- ((pri & 0x7f) >> (7 - plat_bits))
+ ((((unsigned) (pri)) & 0x7fu) >> (7u - (plat_bits)))
/* Install exception priority descriptor at a suitable index */
#define EHF_PRI_DESC(plat_bits, priority) \
[EHF_PRI_TO_IDX(priority, plat_bits)] = { \
- .ehf_handler = _EHF_NO_HANDLER, \
+ .ehf_handler = EHF_NO_HANDLER_, \
}
/* Macro for platforms to regiter its exception priorities */
#define EHF_REGISTER_PRIORITIES(priorities, num, bits) \
const ehf_priorities_t exception_data = { \
- .num_priorities = num, \
- .ehf_priorities = priorities, \
- .pri_bits = bits, \
+ .num_priorities = (num), \
+ .ehf_priorities = (priorities), \
+ .pri_bits = (bits), \
}
/*
@@ -72,10 +72,10 @@
uintptr_t ehf_handler;
} ehf_pri_desc_t;
-typedef struct ehf_priorities {
+typedef struct ehf_priority_type {
ehf_pri_desc_t *ehf_priorities;
unsigned int num_priorities;
- int pri_bits;
+ unsigned int pri_bits;
} ehf_priorities_t;
void ehf_init(void);
@@ -87,4 +87,4 @@
#endif /* __ASSEMBLY__ */
-#endif /* __EHF_H__ */
+#endif /* EHF_H */