[PATCH v3 12/49] binman: Use super() instead of specifying parent type
Simon Glass
sjg at chromium.org
Fri Jul 10 02:39:35 CEST 2020
It is easier and less error-prone to use super() when the parent type is
needed. Update binman to remove the type names.
Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
---
(no changes since v1)
tools/binman/etype/_testing.py | 4 ++--
tools/binman/etype/blob.py | 2 +-
tools/binman/etype/blob_dtb.py | 6 +++---
tools/binman/etype/blob_named_by_arg.py | 2 +-
tools/binman/etype/cbfs.py | 14 +++++++-------
tools/binman/etype/cros_ec_rw.py | 3 +--
tools/binman/etype/fdtmap.py | 2 +-
tools/binman/etype/files.py | 2 +-
tools/binman/etype/fill.py | 4 ++--
tools/binman/etype/fmap.py | 2 +-
tools/binman/etype/gbb.py | 2 +-
tools/binman/etype/image_header.py | 4 ++--
tools/binman/etype/intel_cmc.py | 2 +-
tools/binman/etype/intel_descriptor.py | 4 ++--
tools/binman/etype/intel_fit.py | 4 ++--
tools/binman/etype/intel_fit_ptr.py | 4 ++--
tools/binman/etype/intel_fsp.py | 2 +-
tools/binman/etype/intel_fsp_m.py | 2 +-
tools/binman/etype/intel_fsp_s.py | 2 +-
tools/binman/etype/intel_fsp_t.py | 2 +-
tools/binman/etype/intel_ifwi.py | 4 ++--
tools/binman/etype/intel_me.py | 2 +-
tools/binman/etype/intel_mrc.py | 2 +-
tools/binman/etype/intel_refcode.py | 2 +-
tools/binman/etype/intel_vbt.py | 2 +-
tools/binman/etype/intel_vga.py | 2 +-
tools/binman/etype/mkimage.py | 2 +-
.../etype/powerpc_mpc85xx_bootpg_resetvec.py | 2 +-
tools/binman/etype/section.py | 16 ++++++++--------
tools/binman/etype/text.py | 2 +-
tools/binman/etype/u_boot.py | 2 +-
tools/binman/etype/u_boot_dtb.py | 2 +-
tools/binman/etype/u_boot_dtb_with_ucode.py | 4 ++--
tools/binman/etype/u_boot_elf.py | 4 ++--
tools/binman/etype/u_boot_img.py | 2 +-
tools/binman/etype/u_boot_nodtb.py | 2 +-
tools/binman/etype/u_boot_spl.py | 2 +-
tools/binman/etype/u_boot_spl_bss_pad.py | 2 +-
tools/binman/etype/u_boot_spl_dtb.py | 2 +-
tools/binman/etype/u_boot_spl_elf.py | 2 +-
tools/binman/etype/u_boot_spl_nodtb.py | 2 +-
tools/binman/etype/u_boot_spl_with_ucode_ptr.py | 2 +-
tools/binman/etype/u_boot_tpl.py | 2 +-
tools/binman/etype/u_boot_tpl_dtb.py | 2 +-
tools/binman/etype/u_boot_tpl_dtb_with_ucode.py | 2 +-
tools/binman/etype/u_boot_tpl_elf.py | 2 +-
tools/binman/etype/u_boot_tpl_with_ucode_ptr.py | 2 +-
tools/binman/etype/u_boot_ucode.py | 2 +-
tools/binman/etype/u_boot_with_ucode_ptr.py | 2 +-
tools/binman/etype/vblock.py | 2 +-
tools/binman/etype/x86_reset16.py | 2 +-
tools/binman/etype/x86_reset16_spl.py | 2 +-
tools/binman/etype/x86_reset16_tpl.py | 2 +-
tools/binman/etype/x86_start16.py | 2 +-
tools/binman/etype/x86_start16_spl.py | 2 +-
tools/binman/etype/x86_start16_tpl.py | 2 +-
tools/binman/image.py | 12 ++++++------
57 files changed, 86 insertions(+), 87 deletions(-)
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index ea60561adb..0800c25899 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -41,10 +41,10 @@ class Entry__testing(Entry):
data type (generating an error)
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def ReadNode(self):
- Entry.ReadNode(self)
+ super().ReadNode()
self.return_invalid_entry = fdt_util.GetBool(self._node,
'return-invalid-entry')
self.return_unknown_contents = fdt_util.GetBool(self._node,
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index ede7a7a68c..e507203709 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -31,7 +31,7 @@ class Entry_blob(Entry):
data.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._filename = fdt_util.GetString(self._node, 'filename', self.etype)
self.compress = fdt_util.GetString(self._node, 'compress', 'none')
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index 6c06943763..724647a7bb 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -20,13 +20,13 @@ class Entry_blob_dtb(Entry_blob):
global state
from binman import state
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def ObtainContents(self):
"""Get the device-tree from the list held by the 'state' module"""
self._filename = self.GetDefaultFilename()
self._pathname, _ = state.GetFdtContents(self.GetFdtEtype())
- return Entry_blob.ReadBlobContents(self)
+ return super().ReadBlobContents()
def ProcessContents(self):
"""Re-read the DTB contents so that we get any calculated properties"""
@@ -57,7 +57,7 @@ class Entry_blob_dtb(Entry_blob):
return {self.GetFdtEtype(): [self, fname]}
def WriteData(self, data, decomp=True):
- ok = Entry_blob.WriteData(self, data, decomp)
+ ok = super().WriteData(data, decomp)
# Update the state module, since it has the authoritative record of the
# device trees used. If we don't do this, then state.GetFdtContents()
diff --git a/tools/binman/etype/blob_named_by_arg.py b/tools/binman/etype/blob_named_by_arg.py
index 3b4593f071..e95dabe4d0 100644
--- a/tools/binman/etype/blob_named_by_arg.py
+++ b/tools/binman/etype/blob_named_by_arg.py
@@ -29,6 +29,6 @@ class Entry_blob_named_by_arg(Entry_blob):
See cros_ec_rw for an example of this.
"""
def __init__(self, section, etype, node, blob_fname):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._filename, = self.GetEntryArgsOrProps(
[EntryArg('%s-path' % blob_fname, str)])
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index 744a32fa0c..650ab2c292 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -167,7 +167,7 @@ class Entry_cbfs(Entry):
global state
from binman import state
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
self._cbfs_entries = OrderedDict()
self._ReadSubnodes()
@@ -226,7 +226,7 @@ class Entry_cbfs(Entry):
Args:
image_pos: Position of this entry in the image
"""
- Entry.SetImagePos(self, image_pos)
+ super().SetImagePos(image_pos)
# Now update the entries with info from the CBFS entries
for entry in self._cbfs_entries.values():
@@ -238,7 +238,7 @@ class Entry_cbfs(Entry):
entry.uncomp_size = cfile.memlen
def AddMissingProperties(self):
- Entry.AddMissingProperties(self)
+ super().AddMissingProperties()
for entry in self._cbfs_entries.values():
entry.AddMissingProperties()
if entry._cbfs_compress:
@@ -250,7 +250,7 @@ class Entry_cbfs(Entry):
def SetCalculatedProperties(self):
"""Set the value of device-tree properties calculated by binman"""
- Entry.SetCalculatedProperties(self)
+ super().SetCalculatedProperties()
for entry in self._cbfs_entries.values():
state.SetInt(entry._node, 'offset', entry.offset)
state.SetInt(entry._node, 'size', entry.size)
@@ -260,7 +260,7 @@ class Entry_cbfs(Entry):
def ListEntries(self, entries, indent):
"""Override this method to list all files in the section"""
- Entry.ListEntries(self, entries, indent)
+ super().ListEntries(entries, indent)
for entry in self._cbfs_entries.values():
entry.ListEntries(entries, indent + 1)
@@ -268,12 +268,12 @@ class Entry_cbfs(Entry):
return self._cbfs_entries
def ReadData(self, decomp=True):
- data = Entry.ReadData(self, True)
+ data = super().ReadData(True)
return data
def ReadChildData(self, child, decomp=True):
if not self.reader:
- data = Entry.ReadData(self, True)
+ data = super().ReadData(True)
self.reader = cbfs_util.CbfsReader(data)
reader = self.reader
cfile = reader.files.get(child.name)
diff --git a/tools/binman/etype/cros_ec_rw.py b/tools/binman/etype/cros_ec_rw.py
index 0dbe14b342..7ad62d0265 100644
--- a/tools/binman/etype/cros_ec_rw.py
+++ b/tools/binman/etype/cros_ec_rw.py
@@ -18,5 +18,4 @@ class Entry_cros_ec_rw(Entry_blob_named_by_arg):
updating the EC on startup via software sync.
"""
def __init__(self, section, etype, node):
- Entry_blob_named_by_arg.__init__(self, section, etype, node,
- 'cros-ec-rw')
+ super().__init__(section, etype, node, 'cros-ec-rw')
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index aa8807990b..6ca88a100e 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -85,7 +85,7 @@ class Entry_fdtmap(Entry):
from binman import state
from dtoc.fdt import Fdt
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def _GetFdtmap(self):
"""Build an FDT map from the entries in the current image
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
index 10ab585f0e..9adb3afeb1 100644
--- a/tools/binman/etype/files.py
+++ b/tools/binman/etype/files.py
@@ -32,7 +32,7 @@ class Entry_files(Entry_section):
global state
from binman import state
- Entry_section.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._pattern = fdt_util.GetString(self._node, 'pattern')
if not self._pattern:
self.Raise("Missing 'pattern' property")
diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py
index 860410ed6e..efb2d13e91 100644
--- a/tools/binman/etype/fill.py
+++ b/tools/binman/etype/fill.py
@@ -22,10 +22,10 @@ class Entry_fill(Entry):
byte value of a region.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def ReadNode(self):
- Entry.ReadNode(self)
+ super().ReadNode()
if self.size is None:
self.Raise("'fill' entry must have a size property")
self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index a43fac38de..3e9b815d11 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -32,7 +32,7 @@ class Entry_fmap(Entry):
the sub-entries are ignored.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def _GetFmap(self):
"""Build an FMAP from the entries in the current image
diff --git a/tools/binman/etype/gbb.py b/tools/binman/etype/gbb.py
index dd10599717..41554eba8f 100644
--- a/tools/binman/etype/gbb.py
+++ b/tools/binman/etype/gbb.py
@@ -54,7 +54,7 @@ class Entry_gbb(Entry):
README.chromium for how to obtain the required keys and tools.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps(
[EntryArg('hardware-id', str),
EntryArg('keydir', str),
diff --git a/tools/binman/etype/image_header.py b/tools/binman/etype/image_header.py
index 176bdeb29b..2401188495 100644
--- a/tools/binman/etype/image_header.py
+++ b/tools/binman/etype/image_header.py
@@ -57,7 +57,7 @@ class Entry_image_header(Entry):
first/last in the entry list.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.location = fdt_util.GetString(self._node, 'location')
def _GetHeader(self):
@@ -101,7 +101,7 @@ class Entry_image_header(Entry):
else:
offset = image_size - IMAGE_HEADER_LEN
offset += self.section.GetStartOffset()
- return Entry.Pack(self, offset)
+ return super().Pack(offset)
def ProcessContents(self):
"""Write an updated version of the FDT map to this entry
diff --git a/tools/binman/etype/intel_cmc.py b/tools/binman/etype/intel_cmc.py
index 5e6edbe4df..9ab471e7b6 100644
--- a/tools/binman/etype/intel_cmc.py
+++ b/tools/binman/etype/intel_cmc.py
@@ -20,4 +20,4 @@ class Entry_intel_cmc(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py
index d4d7a26901..6afc42ece5 100644
--- a/tools/binman/etype/intel_descriptor.py
+++ b/tools/binman/etype/intel_descriptor.py
@@ -45,14 +45,14 @@ class Entry_intel_descriptor(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._regions = []
def Pack(self, offset):
"""Put this entry at the start of the image"""
if self.offset is None:
offset = self.section.GetStartOffset()
- return Entry_blob.Pack(self, offset)
+ return super().Pack(offset)
def GetOffsets(self):
offset = self.data.find(FD_SIGNATURE)
diff --git a/tools/binman/etype/intel_fit.py b/tools/binman/etype/intel_fit.py
index ea482a6125..ad6c1caa85 100644
--- a/tools/binman/etype/intel_fit.py
+++ b/tools/binman/etype/intel_fit.py
@@ -19,11 +19,11 @@ class Entry_intel_fit(Entry_blob):
At present binman only supports a basic FIT with no microcode.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def ReadNode(self):
"""Force 16-byte alignment as required by FIT pointer"""
- Entry_blob.ReadNode(self)
+ super().ReadNode()
self.align = 16
def ObtainContents(self):
diff --git a/tools/binman/etype/intel_fit_ptr.py b/tools/binman/etype/intel_fit_ptr.py
index df118a68f2..a06d12e740 100644
--- a/tools/binman/etype/intel_fit_ptr.py
+++ b/tools/binman/etype/intel_fit_ptr.py
@@ -16,7 +16,7 @@ class Entry_intel_fit_ptr(Entry_blob):
0xffffffc0 in the image.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
if self.HasSibling('intel-fit') is False:
self.Raise("'intel-fit-ptr' section must have an 'intel-fit' sibling")
@@ -38,4 +38,4 @@ class Entry_intel_fit_ptr(Entry_blob):
def Pack(self, offset):
"""Special pack method to set the offset to the right place"""
- return Entry_blob.Pack(self, 0xffffffc0)
+ return super().Pack(0xffffffc0)
diff --git a/tools/binman/etype/intel_fsp.py b/tools/binman/etype/intel_fsp.py
index 7db3d96b43..a1c89adcea 100644
--- a/tools/binman/etype/intel_fsp.py
+++ b/tools/binman/etype/intel_fsp.py
@@ -24,4 +24,4 @@ class Entry_intel_fsp(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_fsp_m.py b/tools/binman/etype/intel_fsp_m.py
index 51b4e7e1ac..4c225b24d3 100644
--- a/tools/binman/etype/intel_fsp_m.py
+++ b/tools/binman/etype/intel_fsp_m.py
@@ -24,4 +24,4 @@ class Entry_intel_fsp_m(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_fsp_s.py b/tools/binman/etype/intel_fsp_s.py
index b3683e476a..9e1107182a 100644
--- a/tools/binman/etype/intel_fsp_s.py
+++ b/tools/binman/etype/intel_fsp_s.py
@@ -24,4 +24,4 @@ class Entry_intel_fsp_s(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_fsp_t.py b/tools/binman/etype/intel_fsp_t.py
index 0f196f0f1c..5dca145a3f 100644
--- a/tools/binman/etype/intel_fsp_t.py
+++ b/tools/binman/etype/intel_fsp_t.py
@@ -23,4 +23,4 @@ class Entry_intel_fsp_t(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index 6a96f6be55..ba63f6574f 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -45,13 +45,13 @@ class Entry_intel_ifwi(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._convert_fit = fdt_util.GetBool(self._node, 'convert-fit')
self._ifwi_entries = OrderedDict()
def ReadNode(self):
self._ReadSubnodes()
- Entry_blob.ReadNode(self)
+ super().ReadNode()
def _BuildIfwi(self):
"""Build the contents of the IFWI and write it to the 'data' property"""
diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py
index 2707ca6912..6b3803819e 100644
--- a/tools/binman/etype/intel_me.py
+++ b/tools/binman/etype/intel_me.py
@@ -27,4 +27,4 @@ class Entry_intel_me(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_mrc.py b/tools/binman/etype/intel_mrc.py
index 854a4dda61..74781848e2 100644
--- a/tools/binman/etype/intel_mrc.py
+++ b/tools/binman/etype/intel_mrc.py
@@ -21,7 +21,7 @@ class Entry_intel_mrc(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'mrc.bin'
diff --git a/tools/binman/etype/intel_refcode.py b/tools/binman/etype/intel_refcode.py
index a1059f787e..5754fec4f8 100644
--- a/tools/binman/etype/intel_refcode.py
+++ b/tools/binman/etype/intel_refcode.py
@@ -21,7 +21,7 @@ class Entry_intel_refcode(Entry_blob):
See README.x86 for information about x86 binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'refcode.bin'
diff --git a/tools/binman/etype/intel_vbt.py b/tools/binman/etype/intel_vbt.py
index 4d465ad017..f6d7b466ea 100644
--- a/tools/binman/etype/intel_vbt.py
+++ b/tools/binman/etype/intel_vbt.py
@@ -19,4 +19,4 @@ class Entry_intel_vbt(Entry_blob):
See README.x86 for information about Intel binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/intel_vga.py b/tools/binman/etype/intel_vga.py
index 04cd72f3dc..6b87c01b4c 100644
--- a/tools/binman/etype/intel_vga.py
+++ b/tools/binman/etype/intel_vga.py
@@ -22,4 +22,4 @@ class Entry_intel_vga(Entry_blob):
See README.x86 for information about Intel binary blobs.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 1aa563963a..8fddc88118 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -33,7 +33,7 @@ class Entry_mkimage(Entry):
binman.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._args = fdt_util.GetString(self._node, 'args').split(' ')
self._mkimage_entries = OrderedDict()
self._ReadSubnodes()
diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
index 28005c60b3..b0fa75fbf8 100644
--- a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
+++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
@@ -19,7 +19,7 @@ class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot-br.bin'
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 91b8e0c110..f108121c3a 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -43,7 +43,7 @@ class Entry_section(Entry):
"""
def __init__(self, section, etype, node, test=False):
if not test:
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._entries = OrderedDict()
self._pad_byte = 0
self._sort = False
@@ -52,7 +52,7 @@ class Entry_section(Entry):
def ReadNode(self):
"""Read properties from the image node"""
- Entry.ReadNode(self)
+ super().ReadNode()
self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
@@ -126,13 +126,13 @@ class Entry_section(Entry):
a section containing a list of files. Process these entries so that
this information is added to the device tree.
"""
- Entry.ExpandEntries(self)
+ super().ExpandEntries()
for entry in self._entries.values():
entry.ExpandEntries()
def AddMissingProperties(self):
"""Add new properties to the device tree as needed for this entry"""
- Entry.AddMissingProperties(self)
+ super().AddMissingProperties()
for entry in self._entries.values():
entry.AddMissingProperties()
@@ -168,14 +168,14 @@ class Entry_section(Entry):
def ResetForPack(self):
"""Reset offset/size fields so that packing can be done again"""
- Entry.ResetForPack(self)
+ super().ResetForPack()
for entry in self._entries.values():
entry.ResetForPack()
def Pack(self, offset):
"""Pack all entries into the section"""
self._PackEntries()
- return Entry.Pack(self, offset)
+ return super().Pack(offset)
def _PackEntries(self):
"""Pack all entries into the image"""
@@ -232,12 +232,12 @@ class Entry_section(Entry):
entry.WriteSymbols(self)
def SetCalculatedProperties(self):
- Entry.SetCalculatedProperties(self)
+ super().SetCalculatedProperties()
for entry in self._entries.values():
entry.SetCalculatedProperties()
def SetImagePos(self, image_pos):
- Entry.SetImagePos(self, image_pos)
+ super().SetImagePos(image_pos)
for entry in self._entries.values():
entry.SetImagePos(image_pos + self.offset)
diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index 3577135adb..a69c2a4ec4 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -57,7 +57,7 @@ class Entry_text(Entry):
by setting the size of the entry to something larger than the text.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
value = fdt_util.GetString(self._node, 'text')
if value:
value = tools.ToBytes(value)
diff --git a/tools/binman/etype/u_boot.py b/tools/binman/etype/u_boot.py
index ab1019b00c..4767197e13 100644
--- a/tools/binman/etype/u_boot.py
+++ b/tools/binman/etype/u_boot.py
@@ -26,7 +26,7 @@ class Entry_u_boot(Entry_blob):
in the binman README for more information.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot.bin'
diff --git a/tools/binman/etype/u_boot_dtb.py b/tools/binman/etype/u_boot_dtb.py
index e98350088f..65e71291d2 100644
--- a/tools/binman/etype/u_boot_dtb.py
+++ b/tools/binman/etype/u_boot_dtb.py
@@ -22,7 +22,7 @@ class Entry_u_boot_dtb(Entry_blob_dtb):
binman to know which entries contain a device tree.
"""
def __init__(self, section, etype, node):
- Entry_blob_dtb.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot.dtb'
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py
index aec145533e..66a9db55ca 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -28,7 +28,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
global state
from binman import state
- Entry_blob_dtb.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.ucode_data = b''
self.collate = False
self.ucode_offset = None
@@ -78,7 +78,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def ObtainContents(self):
# Call the base class just in case it does something important.
- Entry_blob_dtb.ObtainContents(self)
+ super().ObtainContents()
if self.ucode and not self.collate:
for node in self.ucode.subnodes:
data_prop = node.props.get('data')
diff --git a/tools/binman/etype/u_boot_elf.py b/tools/binman/etype/u_boot_elf.py
index 5f906e520c..6614a75faf 100644
--- a/tools/binman/etype/u_boot_elf.py
+++ b/tools/binman/etype/u_boot_elf.py
@@ -21,7 +21,7 @@ class Entry_u_boot_elf(Entry_blob):
relocated to any address for execution.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self._strip = fdt_util.GetBool(self._node, 'strip')
def ReadBlobContents(self):
@@ -31,7 +31,7 @@ class Entry_u_boot_elf(Entry_blob):
tools.WriteFile(out_fname, tools.ReadFile(self._pathname))
tools.Run('strip', out_fname)
self._pathname = out_fname
- Entry_blob.ReadBlobContents(self)
+ super().ReadBlobContents()
return True
def GetDefaultFilename(self):
diff --git a/tools/binman/etype/u_boot_img.py b/tools/binman/etype/u_boot_img.py
index 50cc71d3ce..8a739d8edb 100644
--- a/tools/binman/etype/u_boot_img.py
+++ b/tools/binman/etype/u_boot_img.py
@@ -21,7 +21,7 @@ class Entry_u_boot_img(Entry_blob):
applications.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot.img'
diff --git a/tools/binman/etype/u_boot_nodtb.py b/tools/binman/etype/u_boot_nodtb.py
index e8c0e1a1d6..e84df490f6 100644
--- a/tools/binman/etype/u_boot_nodtb.py
+++ b/tools/binman/etype/u_boot_nodtb.py
@@ -21,7 +21,7 @@ class Entry_u_boot_nodtb(Entry_blob):
U-Boot and the device tree).
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot-nodtb.bin'
diff --git a/tools/binman/etype/u_boot_spl.py b/tools/binman/etype/u_boot_spl.py
index a6fddbe8f1..d66e46140b 100644
--- a/tools/binman/etype/u_boot_spl.py
+++ b/tools/binman/etype/u_boot_spl.py
@@ -32,7 +32,7 @@ class Entry_u_boot_spl(Entry_blob):
binman uses that to look up symbols to write into the SPL binary.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self):
diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py b/tools/binman/etype/u_boot_spl_bss_pad.py
index a6a177a128..596b2bed97 100644
--- a/tools/binman/etype/u_boot_spl_bss_pad.py
+++ b/tools/binman/etype/u_boot_spl_bss_pad.py
@@ -31,7 +31,7 @@ class Entry_u_boot_spl_bss_pad(Entry_blob):
binman uses that to look up the BSS address.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def ObtainContents(self):
fname = tools.GetInputFilename('spl/u-boot-spl')
diff --git a/tools/binman/etype/u_boot_spl_dtb.py b/tools/binman/etype/u_boot_spl_dtb.py
index a0761eeacd..eefc4a44aa 100644
--- a/tools/binman/etype/u_boot_spl_dtb.py
+++ b/tools/binman/etype/u_boot_spl_dtb.py
@@ -19,7 +19,7 @@ class Entry_u_boot_spl_dtb(Entry_blob_dtb):
to activate.
"""
def __init__(self, section, etype, node):
- Entry_blob_dtb.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'spl/u-boot-spl.dtb'
diff --git a/tools/binman/etype/u_boot_spl_elf.py b/tools/binman/etype/u_boot_spl_elf.py
index f99f74abab..7f1236bcbb 100644
--- a/tools/binman/etype/u_boot_spl_elf.py
+++ b/tools/binman/etype/u_boot_spl_elf.py
@@ -18,7 +18,7 @@ class Entry_u_boot_spl_elf(Entry_blob):
be relocated to any address for execution.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'spl/u-boot-spl'
diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py
index 072b915ff3..6f4529396d 100644
--- a/tools/binman/etype/u_boot_spl_nodtb.py
+++ b/tools/binman/etype/u_boot_spl_nodtb.py
@@ -22,7 +22,7 @@ class Entry_u_boot_spl_nodtb(Entry_blob):
both SPL and the device tree).
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'spl/u-boot-spl-nodtb.bin'
diff --git a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
index b1543a5ef3..72739a5eb6 100644
--- a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
@@ -18,7 +18,7 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
process.
"""
def __init__(self, section, etype, node):
- Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self):
diff --git a/tools/binman/etype/u_boot_tpl.py b/tools/binman/etype/u_boot_tpl.py
index 6562457c9a..02287ab327 100644
--- a/tools/binman/etype/u_boot_tpl.py
+++ b/tools/binman/etype/u_boot_tpl.py
@@ -32,7 +32,7 @@ class Entry_u_boot_tpl(Entry_blob):
binman uses that to look up symbols to write into the TPL binary.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.elf_fname = 'tpl/u-boot-tpl'
def GetDefaultFilename(self):
diff --git a/tools/binman/etype/u_boot_tpl_dtb.py b/tools/binman/etype/u_boot_tpl_dtb.py
index 890155f271..2ff1d7ced1 100644
--- a/tools/binman/etype/u_boot_tpl_dtb.py
+++ b/tools/binman/etype/u_boot_tpl_dtb.py
@@ -19,7 +19,7 @@ class Entry_u_boot_tpl_dtb(Entry_blob_dtb):
to activate.
"""
def __init__(self, section, etype, node):
- Entry_blob_dtb.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'tpl/u-boot-tpl.dtb'
diff --git a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
index ca1bf85ace..066f18dfef 100644
--- a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
@@ -16,7 +16,7 @@ class Entry_u_boot_tpl_dtb_with_ucode(Entry_u_boot_dtb_with_ucode):
process.
"""
def __init__(self, section, etype, node):
- Entry_u_boot_dtb_with_ucode.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'tpl/u-boot-tpl.dtb'
diff --git a/tools/binman/etype/u_boot_tpl_elf.py b/tools/binman/etype/u_boot_tpl_elf.py
index 7fa8e96364..3f24d3aa7b 100644
--- a/tools/binman/etype/u_boot_tpl_elf.py
+++ b/tools/binman/etype/u_boot_tpl_elf.py
@@ -18,7 +18,7 @@ class Entry_u_boot_tpl_elf(Entry_blob):
be relocated to any address for execution.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'tpl/u-boot-tpl'
diff --git a/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py b/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
index 7f7fab7105..c7f3f9dedb 100644
--- a/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
@@ -20,7 +20,7 @@ class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
process.
"""
def __init__(self, section, etype, node):
- Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.elf_fname = 'tpl/u-boot-tpl'
def GetDefaultFilename(self):
diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py
index d9e1a605ef..4462293618 100644
--- a/tools/binman/etype/u_boot_ucode.py
+++ b/tools/binman/etype/u_boot_ucode.py
@@ -58,7 +58,7 @@ class Entry_u_boot_ucode(Entry_blob):
contents of this entry.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def ObtainContents(self):
# If the section does not need microcode, there is nothing to do
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 06047b654d..92d2fc6853 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -29,7 +29,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
complicated. Otherwise it is the same as the u_boot entry.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.elf_fname = 'u-boot'
self.target_offset = None
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py
index 5753de7ec7..f734fbaec4 100644
--- a/tools/binman/etype/vblock.py
+++ b/tools/binman/etype/vblock.py
@@ -36,7 +36,7 @@ class Entry_vblock(Entry):
and kernel are genuine.
"""
def __init__(self, section, etype, node):
- Entry.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
self.content = fdt_util.GetPhandleList(self._node, 'content')
if not self.content:
self.Raise("Vblock must have a 'content' property")
diff --git a/tools/binman/etype/x86_reset16.py b/tools/binman/etype/x86_reset16.py
index ad864e5442..5d49f16e21 100644
--- a/tools/binman/etype/x86_reset16.py
+++ b/tools/binman/etype/x86_reset16.py
@@ -23,7 +23,7 @@ class Entry_x86_reset16(Entry_blob):
For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot-x86-reset16.bin'
diff --git a/tools/binman/etype/x86_reset16_spl.py b/tools/binman/etype/x86_reset16_spl.py
index 9a663f0ae2..775b90699b 100644
--- a/tools/binman/etype/x86_reset16_spl.py
+++ b/tools/binman/etype/x86_reset16_spl.py
@@ -23,7 +23,7 @@ class Entry_x86_reset16_spl(Entry_blob):
For 32-bit U-Boot, the 'x86_reset_spl' entry type is used instead.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'spl/u-boot-x86-reset16-spl.bin'
diff --git a/tools/binman/etype/x86_reset16_tpl.py b/tools/binman/etype/x86_reset16_tpl.py
index 864508f367..52d3f4869a 100644
--- a/tools/binman/etype/x86_reset16_tpl.py
+++ b/tools/binman/etype/x86_reset16_tpl.py
@@ -23,7 +23,7 @@ class Entry_x86_reset16_tpl(Entry_blob):
For 32-bit U-Boot, the 'x86_reset_tpl' entry type is used instead.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'tpl/u-boot-x86-reset16-tpl.bin'
diff --git a/tools/binman/etype/x86_start16.py b/tools/binman/etype/x86_start16.py
index d8345f6722..18fdd95d37 100644
--- a/tools/binman/etype/x86_start16.py
+++ b/tools/binman/etype/x86_start16.py
@@ -25,7 +25,7 @@ class Entry_x86_start16(Entry_blob):
For 64-bit U-Boot, the 'x86_start16_spl' entry type is used instead.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'u-boot-x86-start16.bin'
diff --git a/tools/binman/etype/x86_start16_spl.py b/tools/binman/etype/x86_start16_spl.py
index ad520d3c6d..ac8e90f2e0 100644
--- a/tools/binman/etype/x86_start16_spl.py
+++ b/tools/binman/etype/x86_start16_spl.py
@@ -25,7 +25,7 @@ class Entry_x86_start16_spl(Entry_blob):
For 32-bit U-Boot, the 'x86-start16' entry type is used instead.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'spl/u-boot-x86-start16-spl.bin'
diff --git a/tools/binman/etype/x86_start16_tpl.py b/tools/binman/etype/x86_start16_tpl.py
index ccc8727d1d..72d4608bb7 100644
--- a/tools/binman/etype/x86_start16_tpl.py
+++ b/tools/binman/etype/x86_start16_tpl.py
@@ -26,7 +26,7 @@ class Entry_x86_start16_tpl(Entry_blob):
may be used instead.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ super().__init__(section, etype, node)
def GetDefaultFilename(self):
return 'tpl/u-boot-x86-start16-tpl.bin'
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 523b274c31..a8772c3763 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -45,7 +45,7 @@ class Image(section.Entry_section):
we create a section manually.
"""
def __init__(self, name, node, copy_to_orig=True, test=False):
- section.Entry_section.__init__(self, None, 'section', node, test=test)
+ super().__init__(None, 'section', node, test=test)
self.copy_to_orig = copy_to_orig
self.name = 'main-section'
self.image_name = name
@@ -57,7 +57,7 @@ class Image(section.Entry_section):
self.ReadNode()
def ReadNode(self):
- section.Entry_section.ReadNode(self)
+ super().ReadNode()
filename = fdt_util.GetString(self._node, 'filename')
if filename:
self._filename = filename
@@ -116,11 +116,11 @@ class Image(section.Entry_section):
def PackEntries(self):
"""Pack all entries into the image"""
- section.Entry_section.Pack(self, 0)
+ super().Pack(0)
def SetImagePos(self):
# This first section in the image so it starts at 0
- section.Entry_section.SetImagePos(self, 0)
+ super().SetImagePos(0)
def ProcessEntryContents(self):
"""Call the ProcessContents() method for each entry
@@ -139,7 +139,7 @@ class Image(section.Entry_section):
def WriteSymbols(self):
"""Write symbol values into binary files for access at run time"""
- section.Entry_section.WriteSymbols(self, self)
+ super().WriteSymbols(self)
def BuildImage(self):
"""Write the image to a file"""
@@ -161,7 +161,7 @@ class Image(section.Entry_section):
with open(fname, 'w') as fd:
print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'),
file=fd)
- section.Entry_section.WriteMap(self, fd, 0)
+ super().WriteMap(fd, 0)
return fname
def BuildEntryList(self):
--
2.27.0.389.gc38d7665816-goog
More information about the U-Boot
mailing list