summaryrefslogtreecommitdiff
path: root/lib/utils/timer/fdt_timer.c
diff options
context:
space:
mode:
authorSamuel Holland <[email protected]>2024-11-11 14:02:45 -0800
committerAnup Patel <[email protected]>2024-11-28 17:09:17 +0530
commitdf1c1000014049d95d65de831f9015a2dcf9fa34 (patch)
tree09ada6ab220ee86c1169a85777c32f2f2a6a1c47 /lib/utils/timer/fdt_timer.c
parent23ef9c5f00b81cffbbf7ff6894f241fad07ee4b7 (diff)
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 <[email protected]> Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/utils/timer/fdt_timer.c')
-rw-r--r--lib/utils/timer/fdt_timer.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/utils/timer/fdt_timer.c b/lib/utils/timer/fdt_timer.c
index 37965f5e..a2412409 100644
--- a/lib/utils/timer/fdt_timer.c
+++ b/lib/utils/timer/fdt_timer.c
@@ -13,8 +13,7 @@
#include <sbi_utils/timer/fdt_timer.h>
/* List of FDT timer drivers generated at compile time */
-extern struct fdt_timer *fdt_timer_drivers[];
-extern unsigned long fdt_timer_drivers_size;
+extern struct fdt_timer *const fdt_timer_drivers[];
int fdt_timer_init(void)
{
@@ -23,7 +22,7 @@ int fdt_timer_init(void)
const struct fdt_match *match;
const void *fdt = fdt_get_address();
- for (pos = 0; pos < fdt_timer_drivers_size; pos++) {
+ for (pos = 0; fdt_timer_drivers[pos]; pos++) {
drv = fdt_timer_drivers[pos];
noff = -1;