In order to apply overlays or create new nodes under the root node, the
kernel expects of_root to be set. On some system were a device-tree us
not provided by firmware (x86 for instance) if CONFIG_OF is enabled,
then we will end up with a null of_root. This series add support to
create this root node using a builtin dtb and remove the manual
creation of the root node done in unittests.c.
Clément Léger (2):
of: base: populate of_root node if not set
of: unittest: remove check for of_root
drivers/of/Makefile | 2 +-
drivers/of/base.c | 18 ++++++++++++++++--
drivers/of/empty_root.dts | 6 ++++++
drivers/of/unittest.c | 10 ----------
4 files changed, 23 insertions(+), 13 deletions(-)
create mode 100644 drivers/of/empty_root.dts
--
2.36.1
Now that of_root node is always populated in of_core_init(), remove
this manual tree creation and assume that the root node always exists.
Signed-off-by: Clément Léger <[email protected]>
---
drivers/of/unittest.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 7f6bba18c515..a787d212c0f6 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1469,16 +1469,6 @@ static int __init unittest_data_add(void)
return -EINVAL;
}
- if (!of_root) {
- of_root = unittest_data_node;
- for_each_of_allnodes(np)
- __of_attach_node_sysfs(np);
- of_aliases = of_find_node_by_path("/aliases");
- of_chosen = of_find_node_by_path("/chosen");
- of_overlay_mutex_unlock();
- return 0;
- }
-
EXPECT_BEGIN(KERN_INFO,
"Duplicate name in testcase-data, renamed to \"duplicate-name#1\"");
--
2.36.1