[PATCH 2/6] Set DTSF_PLUGIN if needed when compiling from dtb

Uwe Kleine-König <[email protected]>
Newsgroups org.kernel.vger.devicetree-compiler
Message-ID <03075deef27a7474914093282be9bb4e27dbce81.1755692822.git.u.kleine-koenig@baylibre.com>
The need for the plugin flag is determined by the existence of __fixups__
or __local_fixups__.

This is a bit simplifying because if __fixups__ or __local_fixups__
exist but don't have properties, the plugin flag isn't needed. But in
practise the test should be good enough such that this corner case
doesn't matter.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
 flattree.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/flattree.c b/flattree.c
index 30e6de2044b2..f3b698c17e89 100644
--- a/flattree.c
+++ b/flattree.c
@@ -807,6 +807,7 @@ struct dt_info *dt_from_blob(const char *fname)
 	struct node *tree;
 	uint32_t val;
 	int flags = 0;
+	unsigned int dtsflags = DTSF_V1;
 
 	f = srcfile_relative_open(fname, NULL);
 
@@ -919,5 +920,8 @@ struct dt_info *dt_from_blob(const char *fname)
 
 	fclose(f);
 
-	return build_dt_info(DTSF_V1, reservelist, tree, boot_cpuid_phys);
+	if (get_subnode(tree, "__fixups__") || get_subnode(tree, "__local_fixups__"))
+		dtsflags |= DTSF_PLUGIN;
+
+	return build_dt_info(dtsflags, reservelist, tree, boot_cpuid_phys);
 }
-- 
2.50.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.