diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-03-31 09:27:31 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-05-02 12:06:11 +0300 |
commit | f20ea066401dd189253967bc78e4e28fc142c6c3 (patch) | |
tree | 742c11a3e35046aba929508b68b46a0dbcb1875d /platform | |
parent | 82d0da39fb22300cdfe5432a593d438b2e44b89d (diff) |
linux-gen: sysinfo: use helper macro for calculating array size
Use _ODP_ARRAY_SIZE() helper macro for calculating array sizes.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-generic/arch/aarch64/cpu_flags.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/platform/linux-generic/arch/aarch64/cpu_flags.c b/platform/linux-generic/arch/aarch64/cpu_flags.c index d70e26271..e013f749f 100644 --- a/platform/linux-generic/arch/aarch64/cpu_flags.c +++ b/platform/linux-generic/arch/aarch64/cpu_flags.c @@ -1,19 +1,22 @@ /* Copyright (c) 2018, Linaro Limited - * Copyright (c) 2020-2021, Nokia + * Copyright (c) 2020-2022, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#include <string.h> -#include <stdlib.h> -#include <sys/auxv.h> -#include <asm/hwcap.h> - #include <odp/api/hints.h> + #include <odp_debug_internal.h> +#include <odp_macros_internal.h> + #include "cpu_flags.h" +#include <asm/hwcap.h> +#include <string.h> +#include <stdlib.h> +#include <sys/auxv.h> + typedef struct { const char *feat_flag; const unsigned int hwcap_field; @@ -895,7 +898,7 @@ static void _odp_sys_info_print_hwcap_flags(void) /* Print supported hardware flags via AT_HWCAP entry of the hwcaps * auxiliary vector. */ hwcaps = getauxval(AT_HWCAP); - size = sizeof(hwcap_flags) / sizeof(hwcap_feat_flag_t); + size = _ODP_ARRAY_SIZE(hwcap_flags); for (unsigned int i = 0; i < size; i++) { if (hwcap_flags[i].valid) { if (check_hwcap_duplicates(hwcap_flags[i].hwcap_field)) { @@ -912,7 +915,7 @@ static void _odp_sys_info_print_hwcap_flags(void) /* Print supported hardware flags via AT_HWCAP2 entry of the hwcaps * auxiliary vector. */ hwcaps2 = getauxval(AT_HWCAP2); - size2 = sizeof(hwcap2_flags) / sizeof(hwcap_feat_flag_t); + size2 = _ODP_ARRAY_SIZE(hwcap2_flags); for (unsigned long i = 0; i < size2; i++) { if (hwcap2_flags[i].valid) { if (hwcaps2 & 0x01) |