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 --- lib/utils/regmap/fdt_regmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/utils/regmap') diff --git a/lib/utils/regmap/fdt_regmap.c b/lib/utils/regmap/fdt_regmap.c index 933938fb..ab991c45 100644 --- a/lib/utils/regmap/fdt_regmap.c +++ b/lib/utils/regmap/fdt_regmap.c @@ -13,8 +13,7 @@ #include /* List of FDT regmap drivers generated at compile time */ -extern struct fdt_regmap *fdt_regmap_drivers[]; -extern unsigned long fdt_regmap_drivers_size; +extern struct fdt_regmap *const fdt_regmap_drivers[]; static int fdt_regmap_init(const void *fdt, int nodeoff) { @@ -23,7 +22,7 @@ static int fdt_regmap_init(const void *fdt, int nodeoff) const struct fdt_match *match; /* Try all I2C drivers one-by-one */ - for (pos = 0; pos < fdt_regmap_drivers_size; pos++) { + for (pos = 0; fdt_regmap_drivers[pos]; pos++) { drv = fdt_regmap_drivers[pos]; match = fdt_match_node(fdt, nodeoff, drv->match_table); if (match && drv->init) { -- cgit v1.3.1