summaryrefslogtreecommitdiff
path: root/tools/dtoc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dtoc')
-rw-r--r--tools/dtoc/fdt_util.py15
-rwxr-xr-xtools/dtoc/test_fdt.py3
2 files changed, 2 insertions, 16 deletions
diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index 5fbfc8877b..f47879ac00 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -16,14 +16,6 @@ import tempfile
import command
import tools
-VERSION3 = sys.version_info > (3, 0)
-
-def get_plain_bytes(val):
- """Handle Python 3 strings"""
- if isinstance(val, bytes):
- val = val.decode('utf-8')
- return val.encode('raw_unicode_escape')
-
def fdt32_to_cpu(val):
"""Convert a device tree cell to an integer
@@ -33,9 +25,6 @@ def fdt32_to_cpu(val):
Return:
A native-endian integer value
"""
- if VERSION3:
- # This code is not reached in Python 2
- val = get_plain_bytes(val) # pragma: no cover
return struct.unpack('>I', val)[0]
def fdt_cells_to_cpu(val, cells):
@@ -45,11 +34,11 @@ def fdt_cells_to_cpu(val, cells):
Value to convert (array of one or more 4-character strings)
Return:
- A native-endian long value
+ A native-endian integer value
"""
if not cells:
return 0
- out = long(fdt32_to_cpu(val[0]))
+ out = int(fdt32_to_cpu(val[0]))
if cells == 2:
out = out << 32 | fdt32_to_cpu(val[1])
return out
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 32a020bad2..bf469dbd54 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -518,9 +518,6 @@ class TestFdtUtil(unittest.TestCase):
dtb = fdt_util.EnsureCompiled('tools/dtoc/dtoc_test_simple.dts')
self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb))
- def testGetPlainBytes(self):
- self.assertEqual(b'fred', fdt_util.get_plain_bytes('fred'))
-
def RunTestCoverage():
"""Run the tests and check that we get 100% coverage"""