[PATCH 2/2] lib: utils/serial: Check all compatible devices for driver
Bohdan Fedorov
misterjdrg at gmail.com
Sun Jun 12 10:18:22 PDT 2022
System can have multiple virtio,mmio compatible devices.
We need check all of them to choose serial with emergency
write feature.
Signed-off-by: Bohdan Fedorov <misterjdrg at gmail.com>
---
lib/utils/serial/fdt_serial.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/lib/utils/serial/fdt_serial.c b/lib/utils/serial/fdt_serial.c
index 1a4bf9e..761d567 100644
--- a/lib/utils/serial/fdt_serial.c
+++ b/lib/utils/serial/fdt_serial.c
@@ -76,19 +76,24 @@ int fdt_serial_init(void)
for (pos = 0; pos < fdt_serial_drivers_size; pos++) {
drv = fdt_serial_drivers[pos];
- noff = fdt_find_match(fdt, -1, drv->match_table, &match);
- if (noff < 0)
- continue;
+ noff = -1;
+ do {
+ noff = fdt_find_match(fdt, noff, drv->match_table, &match);
- if (drv->init) {
- rc = drv->init(fdt, noff, match);
- if (rc == SBI_ENODEV)
- continue;
- if (rc)
- return rc;
- }
- current_driver = drv;
- break;
+ if (noff < 0)
+ break;
+
+ if (drv->init) {
+ rc = drv->init(fdt, noff, match);
+ if (rc == SBI_ENODEV)
+ continue;
+ if (rc)
+ return rc;
+ }
+
+ current_driver = drv;
+ goto done;
+ } while (noff >= 0);
}
done:
--
2.36.1
More information about the opensbi
mailing list