[U-Boot] [PATCH 18/29] dtoc: Export the _FindNode() function
Simon Glass
sjg at chromium.org
Tue Jul 17 19:25:41 UTC 2018
This is useful for clients that want to find a node. Export it so it can
be used by others.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tools/dtoc/fdt.py | 4 ++--
tools/dtoc/test_fdt.py | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 9d69b426c1..01e39b8a2a 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -181,7 +181,7 @@ class Node:
self.subnodes = []
self.props = {}
- def _FindNode(self, name):
+ def FindNode(self, name):
"""Find a node given its name
Args:
@@ -349,7 +349,7 @@ class Fdt:
if len(parts) < 2:
return None
for part in parts[1:]:
- node = node._FindNode(part)
+ node = node.FindNode(part)
if not node:
return None
return node
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 38e1732f52..abec9e57e1 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -155,12 +155,12 @@ class TestNode(unittest.TestCase):
self.assertEqual(prop.value, value)
def testFindNode(self):
- """Tests that we can find a node using the _FindNode() functoin"""
- node = self.dtb.GetRoot()._FindNode('i2c at 0')
+ """Tests that we can find a node using the FindNode() functoin"""
+ node = self.dtb.GetRoot().FindNode('i2c at 0')
self.assertEqual('i2c at 0', node.name)
- subnode = node._FindNode('pmic at 9')
+ subnode = node.FindNode('pmic at 9')
self.assertEqual('pmic at 9', subnode.name)
- self.assertEqual(None, node._FindNode('missing'))
+ self.assertEqual(None, node.FindNode('missing'))
def testRefreshMissingNode(self):
"""Test refreshing offsets when an extra node is present in dtb"""
--
2.18.0.203.gfac676dfb9-goog
More information about the U-Boot
mailing list