From df1c1000014049d95d65de831f9015a2dcf9fa34 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 11 Nov 2024 14:02:45 -0800 Subject: treewide: Make carray arrays const and NULL-terminated This allows the compiler to generate significantly better code, because it does not have to maintain either the loop counter or loop limit. Plus there are half as many symbols to relocate. This also simplifies passing carray arrays to helper functions. Signed-off-by: Samuel Holland Reviewed-by: Anup Patel --- platform/generic/platform.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'platform/generic/platform.c') diff --git a/platform/generic/platform.c b/platform/generic/platform.c index 768b9b6..fb074d4 100644 --- a/platform/generic/platform.c +++ b/platform/generic/platform.c @@ -30,8 +30,7 @@ #include /* List of platform override modules generated at compile time */ -extern const struct platform_override *platform_override_modules[]; -extern unsigned long platform_override_modules_size; +extern const struct platform_override *const platform_override_modules[]; static const struct platform_override *generic_plat = NULL; static const struct fdt_match *generic_plat_match = NULL; @@ -42,7 +41,7 @@ static void fw_platform_lookup_special(const void *fdt, int root_offset) const struct fdt_match *match; int pos; - for (pos = 0; pos < platform_override_modules_size; pos++) { + for (pos = 0; platform_override_modules[pos]; pos++) { plat = platform_override_modules[pos]; if (!plat->match_table) continue; -- cgit v1.1