From 03b645ed866a46a8762dfff20acc0bd35a54e34f Mon Sep 17 00:00:00 2001 From: Jeenu Viswambharan Date: Thu, 2 Aug 2018 10:14:12 +0100 Subject: 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 --- include/bl31/ehf.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'include/bl31/ehf.h') diff --git a/include/bl31/ehf.h b/include/bl31/ehf.h index f963f8d0c..144627986 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 /* 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 @@ typedef struct ehf_pri_desc { 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 @@ unsigned int ehf_is_ns_preemption_allowed(void); #endif /* __ASSEMBLY__ */ -#endif /* __EHF_H__ */ +#endif /* EHF_H */ -- cgit v1.2.3