diff mbox

[U-Boot,14/19] fdt: Drop use of the legacy libfdt python module

Message ID 20170417022233.28101-15-sjg@chromium.org
State Accepted
Commit 6d804eafc12263fcba423284d453ca9f4fff639f
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass April 17, 2017, 2:22 a.m. UTC
Now that this is no-longer available, stop looking for it. The new module
will be used if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/fdt_normal.py | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

Comments

Simon Glass May 2, 2017, 11:27 a.m. UTC | #1
Now that this is no-longer available, stop looking for it. The new module
will be used if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/fdt_normal.py | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

Applied to u-boot-fdt/next, thanks!
diff mbox

Patch

diff --git a/tools/dtoc/fdt_normal.py b/tools/dtoc/fdt_normal.py
index e793f49fa8..a0e58a4464 100644
--- a/tools/dtoc/fdt_normal.py
+++ b/tools/dtoc/fdt_normal.py
@@ -12,12 +12,7 @@  import sys
 import fdt
 from fdt import Fdt, NodeBase, PropBase
 import fdt_util
-try:
-    import libfdt
-    legacy = False
-except ImportError:
-    import libfdt_legacy as libfdt
-    legacy = True
+import libfdt
 
 
 # This deals with a device tree, presenting it as a list of Node and Prop
@@ -92,10 +87,7 @@  class Node(NodeBase):
         offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset())
         while offset >= 0:
             sep = '' if self.path[-1] == '/' else '/'
-            if legacy:
-                name = libfdt.Name(self._fdt.GetFdt(), offset)
-            else:
-                name = self._fdt._fdt_obj.get_name(offset)
+            name = self._fdt._fdt_obj.get_name(offset)
             path = self.path + sep + name
             node = Node(self._fdt, offset, name, path)
             self.subnodes.append(node)
@@ -148,8 +140,7 @@  class FdtNormal(Fdt):
 
             with open(self._fname) as fd:
                 self._fdt = bytearray(fd.read())
-                if not legacy:
-                    self._fdt_obj = libfdt.Fdt(self._fdt)
+                self._fdt_obj = libfdt.Fdt(self._fdt)
 
     def GetFdt(self):
         """Get the contents of the FDT
@@ -186,18 +177,11 @@  class FdtNormal(Fdt):
         props_dict = {}
         poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset)
         while poffset >= 0:
-            if legacy:
-                dprop, plen = libfdt.fdt_get_property_by_offset(self._fdt,
-                                                                poffset)
-                prop = Prop(node, poffset,
-                            libfdt.String(self._fdt, dprop.nameoff),
-                            libfdt.Data(dprop))
-            else:
-                p = self._fdt_obj.get_property_by_offset(poffset)
-                prop = Prop(node, poffset, p.name, p.value)
-                props_dict[prop.name] = prop
-
-                poffset = libfdt.fdt_next_property_offset(self._fdt, poffset)
+            p = self._fdt_obj.get_property_by_offset(poffset)
+            prop = Prop(node, poffset, p.name, p.value)
+            props_dict[prop.name] = prop
+
+            poffset = libfdt.fdt_next_property_offset(self._fdt, poffset)
         return props_dict
 
     def Invalidate(self):