diff mbox series

[U-Boot,03/53] binman: Move GetFdtSet() into blob_dtb

Message ID 20190720182416.183626-4-sjg@chromium.org
State Accepted
Commit 935461262e322fce6fcfc48caf2b9a6ec05caaae
Delegated to: Simon Glass
Headers show
Series binman: Support replacing entries in an existing image | expand

Commit Message

Simon Glass July 20, 2019, 6:23 p.m. UTC
At present we check the filename to see if an entry holds a device-tree
file. It is easier to use the base class designed for this purpose.

Move this method implementation into Entry_blob_dtb and update the default
one to return an empty set.

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

 tools/binman/entry.py          | 5 -----
 tools/binman/etype/blob_dtb.py | 9 +++++++++
 2 files changed, 9 insertions(+), 5 deletions(-)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
At present we check the filename to see if an entry holds a device-tree
file. It is easier to use the base class designed for this purpose.

Move this method implementation into Entry_blob_dtb and update the default
one to return an empty set.

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

 tools/binman/entry.py          | 5 -----
 tools/binman/etype/blob_dtb.py | 9 +++++++++
 2 files changed, 9 insertions(+), 5 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 1c382f3b852..276035ed324 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -192,11 +192,6 @@  class Entry(object):
             Set containing the filename from this entry, if it is a .dtb, else
             an empty set
         """
-        fname = self.GetDefaultFilename()
-        # It would be better to use isinstance(self, Entry_blob_dtb) here but
-        # we cannot access Entry_blob_dtb
-        if fname and fname.endswith('.dtb'):
-            return set([fname])
         return set()
 
     def ExpandEntries(self):
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index 88ed55d8865..b242c2da38a 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -31,3 +31,12 @@  class Entry_blob_dtb(Entry_blob):
         _, indata = state.GetFdtContents(self._filename)
         data = self.CompressData(indata)
         return self.ProcessContentsUpdate(data)
+
+    def GetFdtSet(self):
+        """Get the set of device trees used by this entry
+
+        Returns:
+            Set containing the filename from this entry
+        """
+        fname = self.GetDefaultFilename()
+        return set([fname])