dtoc: Convert the Fdt.Prop class to Python 3
authorSimon Glass <sjg@chromium.org>
Sat, 18 May 2019 04:00:37 +0000 (22:00 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 10 Jul 2019 22:52:58 +0000 (16:52 -0600)
Update this class to work correctly on Python 3 and to pass its unit
tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/dtoc/fdt.py

index 956e0c98007f40bc569c6ae454a68c4b9f7796ed..2b2470c31473de44d30dc148763130606af9ae40 100644 (file)
@@ -98,18 +98,18 @@ class Prop:
             bytes
         type: Value type
     """
             bytes
         type: Value type
     """
-    def __init__(self, node, offset, name, bytes):
+    def __init__(self, node, offset, name, data):
         self._node = node
         self._offset = offset
         self.name = name
         self.value = None
         self._node = node
         self._offset = offset
         self.name = name
         self.value = None
-        self.bytes = str(bytes)
+        self.bytes = bytes(data)
         self.dirty = False
         self.dirty = False
-        if not bytes:
+        if not data:
             self.type = TYPE_BOOL
             self.value = True
             return
             self.type = TYPE_BOOL
             self.value = True
             return
-        self.type, self.value = BytesToValue(bytes)
+        self.type, self.value = BytesToValue(bytes(data))
 
     def RefreshOffset(self, poffset):
         self._offset = poffset
 
     def RefreshOffset(self, poffset):
         self._offset = poffset