summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-05-12 11:29:52 +0300
committerAnup Patel <anup@brainfault.org>2020-05-23 08:06:33 +0300
commit2c685c214f2815c12f9d70422d85daa7f48003cf (patch)
treef21b5548140c59fe843cc2caa2e444e456ca2474 /lib
parent446a9c6d1eb97fcedd6a94ac76d15e941a6087a8 (diff)
downloadopensbi-2c685c214f2815c12f9d70422d85daa7f48003cf.tar.xz
lib: utils: Extend fdt_find_match() Implementation
We extend fdt_find_match() implementation by adding node offset parameter which represents the first node to match from. The improved fdt_find_match() can be used to find multiple match nodes. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/fdt/fdt_helper.c5
-rw-r--r--lib/utils/ipi/fdt_ipi.c2
-rw-r--r--lib/utils/irqchip/fdt_irqchip.c2
-rw-r--r--lib/utils/reset/fdt_reset.c2
-rw-r--r--lib/utils/serial/fdt_serial.c2
-rw-r--r--lib/utils/timer/fdt_timer.c2
6 files changed, 8 insertions, 7 deletions
diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c
index 61d70d9..58f8951 100644
--- a/lib/utils/fdt/fdt_helper.c
+++ b/lib/utils/fdt/fdt_helper.c
@@ -43,7 +43,8 @@ const struct fdt_match *fdt_match_node(void *fdt, int nodeoff,
return NULL;
}
-int fdt_find_match(void *fdt, const struct fdt_match *match_table,
+int fdt_find_match(void *fdt, int startoff,
+ const struct fdt_match *match_table,
const struct fdt_match **out_match)
{
int nodeoff;
@@ -52,7 +53,7 @@ int fdt_find_match(void *fdt, const struct fdt_match *match_table,
return SBI_ENODEV;
while (match_table->compatible) {
- nodeoff = fdt_node_offset_by_compatible(fdt, -1,
+ nodeoff = fdt_node_offset_by_compatible(fdt, startoff,
match_table->compatible);
if (nodeoff >= 0) {
if (out_match)
diff --git a/lib/utils/ipi/fdt_ipi.c b/lib/utils/ipi/fdt_ipi.c
index d8ba0b2..d99a941 100644
--- a/lib/utils/ipi/fdt_ipi.c
+++ b/lib/utils/ipi/fdt_ipi.c
@@ -69,7 +69,7 @@ static int fdt_ipi_cold_init(void)
for (pos = 0; pos < array_size(ipi_drivers); pos++) {
drv = ipi_drivers[pos];
- noff = fdt_find_match(fdt, drv->match_table, &match);
+ noff = fdt_find_match(fdt, -1, drv->match_table, &match);
if (noff < 0)
continue;
diff --git a/lib/utils/irqchip/fdt_irqchip.c b/lib/utils/irqchip/fdt_irqchip.c
index 5f5cf97..87def52 100644
--- a/lib/utils/irqchip/fdt_irqchip.c
+++ b/lib/utils/irqchip/fdt_irqchip.c
@@ -42,7 +42,7 @@ static int fdt_irqchip_cold_init(void)
for (pos = 0; pos < array_size(irqchip_drivers); pos++) {
drv = irqchip_drivers[pos];
- noff = fdt_find_match(fdt, drv->match_table, &match);
+ noff = fdt_find_match(fdt, -1, drv->match_table, &match);
if (noff < 0)
continue;
diff --git a/lib/utils/reset/fdt_reset.c b/lib/utils/reset/fdt_reset.c
index 98fbb54..dfbd33e 100644
--- a/lib/utils/reset/fdt_reset.c
+++ b/lib/utils/reset/fdt_reset.c
@@ -38,7 +38,7 @@ int fdt_reset_init(void)
for (pos = 0; pos < array_size(reset_drivers); pos++) {
drv = reset_drivers[pos];
- noff = fdt_find_match(fdt, drv->match_table, &match);
+ noff = fdt_find_match(fdt, -1, drv->match_table, &match);
if (noff < 0)
continue;
diff --git a/lib/utils/serial/fdt_serial.c b/lib/utils/serial/fdt_serial.c
index ae1aeea..fa6c478 100644
--- a/lib/utils/serial/fdt_serial.c
+++ b/lib/utils/serial/fdt_serial.c
@@ -91,7 +91,7 @@ int fdt_serial_init(void)
for (pos = 0; pos < array_size(serial_drivers); pos++) {
drv = serial_drivers[pos];
- noff = fdt_find_match(fdt, drv->match_table, &match);
+ noff = fdt_find_match(fdt, -1, drv->match_table, &match);
if (noff < 0)
continue;
diff --git a/lib/utils/timer/fdt_timer.c b/lib/utils/timer/fdt_timer.c
index 1ad08fe..46edb83 100644
--- a/lib/utils/timer/fdt_timer.c
+++ b/lib/utils/timer/fdt_timer.c
@@ -80,7 +80,7 @@ static int fdt_timer_cold_init(void)
for (pos = 0; pos < array_size(timer_drivers); pos++) {
drv = timer_drivers[pos];
- noff = fdt_find_match(fdt, drv->match_table, &match);
+ noff = fdt_find_match(fdt, -1, drv->match_table, &match);
if (noff < 0)
continue;