forked from Mirrors/opensbi
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:

committed by
Anup Patel

parent
23ef9c5f00
commit
df1c100001
@@ -17,8 +17,7 @@
|
||||
#include <sbi_utils/i2c/fdt_i2c.h>
|
||||
|
||||
/* List of FDT i2c adapter drivers generated at compile time */
|
||||
extern struct fdt_i2c_adapter *fdt_i2c_adapter_drivers[];
|
||||
extern unsigned long fdt_i2c_adapter_drivers_size;
|
||||
extern struct fdt_i2c_adapter *const fdt_i2c_adapter_drivers[];
|
||||
|
||||
static int fdt_i2c_adapter_init(const void *fdt, int nodeoff)
|
||||
{
|
||||
@@ -27,7 +26,7 @@ static int fdt_i2c_adapter_init(const void *fdt, int nodeoff)
|
||||
const struct fdt_match *match;
|
||||
|
||||
/* Try all I2C drivers one-by-one */
|
||||
for (pos = 0; pos < fdt_i2c_adapter_drivers_size; pos++) {
|
||||
for (pos = 0; fdt_i2c_adapter_drivers[pos]; pos++) {
|
||||
drv = fdt_i2c_adapter_drivers[pos];
|
||||
match = fdt_match_node(fdt, nodeoff, drv->match_table);
|
||||
if (match && drv->init) {
|
||||
|
Reference in New Issue
Block a user