[RFC Patch 2/3] blspec: take compatible name as argument

Rouven Czerwinski r.czerwinski at pengutronix.de
Thu Mar 3 22:24:12 PST 2022


Instead of retrieving the root compatible itself, let
entry_is_of_compatible take the compatible as an argument. Pass in
of_get_machine_compatible for now, no functional changes.

Signed-off-by: Rouven Czerwinski <r.czerwinski at pengutronix.de>
---
 common/blspec.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/blspec.c b/common/blspec.c
index 0ea857294f..c1b1991338 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -421,7 +421,7 @@ out:
  *
  * returns true if the entry is compatible, false otherwise
  */
-static bool entry_is_of_compatible(struct blspec_entry *entry)
+static bool entry_is_of_compatible(struct blspec_entry *entry, const char *compat)
 {
 	const char *devicetree;
 	const char *abspath;
@@ -429,7 +429,6 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
 	void *fdt = NULL;
 	int ret;
 	struct device_node *root = NULL, *barebox_root;
-	const char *compat;
 	char *filename;
 
 	/* If the entry doesn't specify a devicetree we are compatible */
@@ -445,10 +444,6 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
 	if (!barebox_root)
 		return true;
 
-	ret = of_property_read_string(barebox_root, "compatible", &compat);
-	if (ret)
-		return false;
-
 	if (entry->rootpath)
 		abspath = entry->rootpath;
 	else
@@ -624,7 +619,7 @@ int blspec_scan_directory(struct bootentries *bootentries, const char *root)
 
 		entry = lentry->entry;
 
-		if (!entry_is_of_compatible(entry)) {
+		if (!entry_is_of_compatible(entry, of_get_machine_compatible())) {
 			blspec_entry_free(&entry->entry);
 			list_del(&lentry->list);
 			free(lentry);
-- 
2.35.1




More information about the barebox mailing list