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 <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland authored and Anup Patel committed 2024-11-28 17:09:17 +05:30
1 parent 23ef9c5f00
commit df1c100001
12 files changed
+26 -38

No files matched your search

+2 -3
View File
@@ -13,8 +13,7 @@
#include <sbi/sbi_error.h>
#include <sbi/sbi_trap.h>
extern struct sbi_ecall_extension *sbi_ecall_exts[];
extern unsigned long sbi_ecall_exts_size;
extern struct sbi_ecall_extension *const sbi_ecall_exts[];
u16 sbi_ecall_version_major(void)
{
@@ -148,7 +147,7 @@ int sbi_ecall_init(void)
struct sbi_ecall_extension *ext;
unsigned long i;
for (i = 0; i < sbi_ecall_exts_size; i++) {
for (i = 0; sbi_ecall_exts[i]; i++) {
ext = sbi_ecall_exts[i];
ret = SBI_ENODEV;