]> git.sur5r.net Git - u-boot/commitdiff
dtoc: Use items() to iterate over dictionaries in python 3.x
authorPaul Burton <paul.burton@imgtec.com>
Tue, 27 Sep 2016 15:03:56 +0000 (16:03 +0100)
committersjg <sjg@chromium.org>
Sun, 9 Oct 2016 15:30:32 +0000 (09:30 -0600)
In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in the affected code switch to using
items() anyway for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/dtoc/dtoc.py
tools/dtoc/fdt_fallback.py

index 518aa512169752e487b68d85d3b4585f289df085..12aa9905ece39f689c7ca61372f53753dc28df54 100755 (executable)
@@ -224,14 +224,14 @@ class DtbPlatdata:
             fields = {}
 
             # Get a list of all the valid properties in this node.
             fields = {}
 
             # Get a list of all the valid properties in this node.
-            for name, prop in node.props.iteritems():
+            for name, prop in node.props.items():
                 if name not in PROP_IGNORE_LIST and name[0] != '#':
                     fields[name] = copy.deepcopy(prop)
 
             # If we've seen this node_name before, update the existing struct.
             if node_name in structs:
                 struct = structs[node_name]
                 if name not in PROP_IGNORE_LIST and name[0] != '#':
                     fields[name] = copy.deepcopy(prop)
 
             # If we've seen this node_name before, update the existing struct.
             if node_name in structs:
                 struct = structs[node_name]
-                for name, prop in fields.iteritems():
+                for name, prop in fields.items():
                     oldprop = struct.get(name)
                     if oldprop:
                         oldprop.Widen(prop)
                     oldprop = struct.get(name)
                     if oldprop:
                         oldprop.Widen(prop)
@@ -246,7 +246,7 @@ class DtbPlatdata:
         for node in self._valid_nodes:
             node_name = self.GetCompatName(node)
             struct = structs[node_name]
         for node in self._valid_nodes:
             node_name = self.GetCompatName(node)
             struct = structs[node_name]
-            for name, prop in node.props.iteritems():
+            for name, prop in node.props.items():
                 if name not in PROP_IGNORE_LIST and name[0] != '#':
                     prop.Widen(struct[name])
             upto += 1
                 if name not in PROP_IGNORE_LIST and name[0] != '#':
                     prop.Widen(struct[name])
             upto += 1
@@ -298,7 +298,7 @@ class DtbPlatdata:
             var_name = Conv_name_to_c(node.name)
             self.Buf('static struct %s%s %s%s = {\n' %
                 (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
             var_name = Conv_name_to_c(node.name)
             self.Buf('static struct %s%s %s%s = {\n' %
                 (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
-            for pname, prop in node.props.iteritems():
+            for pname, prop in node.props.items():
                 if pname in PROP_IGNORE_LIST or pname[0] == '#':
                     continue
                 ptype = TYPE_NAMES[prop.type]
                 if pname in PROP_IGNORE_LIST or pname[0] == '#':
                     continue
                 ptype = TYPE_NAMES[prop.type]
index 7d52da71f3aa9819db471ea6db581ef476ba144a..23e26796c8fff84079870b0b5ad22dcb9c0316c5 100644 (file)
@@ -58,7 +58,7 @@ class Node(NodeBase):
         This fills in the props and subnodes properties, recursively
         searching into subnodes so that the entire tree is built.
         """
         This fills in the props and subnodes properties, recursively
         searching into subnodes so that the entire tree is built.
         """
-        for name, byte_list_str in self._fdt.GetProps(self.path).iteritems():
+        for name, byte_list_str in self._fdt.GetProps(self.path).items():
             prop = Prop(self, name, byte_list_str)
             self.props[name] = prop
 
             prop = Prop(self, name, byte_list_str)
             self.props[name] = prop