From: Anup Patel Date: Fri, 13 May 2022 03:56:20 +0000 (+0530) Subject: lib: utils/timer: Generate FDT timer driver list at compile-time X-Git-Tag: v1.1~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfeb305e0f8da3f8bdff97a21a6628c3156fbfff;p=platform%2Fkernel%2Fopensbi.git lib: utils/timer: Generate FDT timer driver list at compile-time Instead of having FDT timer driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- diff --git a/lib/utils/timer/fdt_timer.c b/lib/utils/timer/fdt_timer.c index 781bb63..4695c0f 100644 --- a/lib/utils/timer/fdt_timer.c +++ b/lib/utils/timer/fdt_timer.c @@ -12,11 +12,9 @@ #include #include -extern struct fdt_timer fdt_timer_mtimer; - -static struct fdt_timer *timer_drivers[] = { - &fdt_timer_mtimer -}; +/* List of FDT timer drivers generated at compile time */ +extern struct fdt_timer *fdt_timer_drivers[]; +extern unsigned long fdt_timer_drivers_size; static struct fdt_timer dummy = { .match_table = NULL, @@ -47,8 +45,8 @@ static int fdt_timer_cold_init(void) const struct fdt_match *match; void *fdt = fdt_get_address(); - for (pos = 0; pos < array_size(timer_drivers); pos++) { - drv = timer_drivers[pos]; + for (pos = 0; pos < fdt_timer_drivers_size; pos++) { + drv = fdt_timer_drivers[pos]; noff = -1; while ((noff = fdt_find_match(fdt, noff, diff --git a/lib/utils/timer/fdt_timer_drivers.carray b/lib/utils/timer/fdt_timer_drivers.carray new file mode 100644 index 0000000..c62ee73 --- /dev/null +++ b/lib/utils/timer/fdt_timer_drivers.carray @@ -0,0 +1,3 @@ +HEADER: sbi_utils/timer/fdt_timer.h +TYPE: struct fdt_timer +NAME: fdt_timer_drivers diff --git a/lib/utils/timer/objects.mk b/lib/utils/timer/objects.mk index 12cffcf..bc4073d 100644 --- a/lib/utils/timer/objects.mk +++ b/lib/utils/timer/objects.mk @@ -8,5 +8,9 @@ # libsbiutils-objs-y += timer/aclint_mtimer.o + libsbiutils-objs-y += timer/fdt_timer.o +libsbiutils-objs-y += timer/fdt_timer_drivers.o + +carray-fdt_timer_drivers-y += fdt_timer_mtimer libsbiutils-objs-y += timer/fdt_timer_mtimer.o