All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info
Date: Thu, 18 Mar 2021 20:25:01 +1300	[thread overview]
Message-ID: <20210318072517.26894-12-sjg@chromium.org> (raw)
In-Reply-To: <20210318072517.26894-1-sjg@chromium.org>

At present we store an entry as the third field in output_fdt_info[].
This is only used to get the type of the entry. Of course multiple entries
may have this same type. Also the entry type is the key to this dict, so
we can use that instead.

Drop the field and update GetUpdateNodes() to suit. Improve the comment for
output_fdt_info a little while here.

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

Changes in v3:
- Add new patch to drop an unnecessary field in output_fdt_info

 tools/binman/state.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/tools/binman/state.py b/tools/binman/state.py
index cef5f660bba..053b4fe73f1 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -23,11 +23,10 @@ DTB_TYPE_FNAME = {
 # 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by
 # binman. They have been copied to <xxx>.out files.
 #
-#   key: entry type
+#   key: entry type (e.g. 'u-boot-dtb)
 #   value: tuple:
 #       Fdt object
 #       Filename
-#       Entry object, or None if not known
 output_fdt_info = {}
 
 # Prefix to add to an fdtmap path to turn it into a path to the /binman node
@@ -124,11 +123,11 @@ def UpdateFdtContents(etype, data):
         etype: Entry type (e.g. 'u-boot-dtb')
         data: Data to replace the DTB with
     """
-    dtb, fname, entry = output_fdt_info[etype]
+    dtb, fname = output_fdt_info[etype]
     dtb_fname = dtb.GetFilename()
     tools.WriteFile(dtb_fname, data)
     dtb = fdt.FdtScan(dtb_fname)
-    output_fdt_info[etype] = [dtb, fname, entry]
+    output_fdt_info[etype] = [dtb, fname]
 
 def SetEntryArgs(args):
     """Set the value of the entry args
@@ -183,10 +182,10 @@ def Prepare(images, dtb):
     main_dtb = dtb
     output_fdt_info.clear()
     fdt_path_prefix = ''
-    output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb', None]
+    output_fdt_info['u-boot-dtb'] = [dtb, 'u-boot.dtb']
     if use_fake_dtb:
         for etype, fname in DTB_TYPE_FNAME.items():
-            output_fdt_info[etype] = [dtb, fname, None]
+            output_fdt_info[etype] = [dtb, fname]
     else:
         fdt_set = {}
         for image in images.values():
@@ -199,7 +198,7 @@ def Prepare(images, dtb):
                     os.path.split(fname)[1])
             tools.WriteFile(out_fname, tools.ReadFile(fname_dtb))
             other_dtb = fdt.FdtScan(out_fname)
-            output_fdt_info[etype] = [other_dtb, out_fname, entry]
+            output_fdt_info[etype] = [other_dtb, out_fname]
 
 def PrepareFromLoadedData(image):
     """Get device tree files ready for use with a loaded image
@@ -222,7 +221,7 @@ def PrepareFromLoadedData(image):
     tout.Info('Preparing device trees')
     output_fdt_info.clear()
     fdt_path_prefix = ''
-    output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb', None]
+    output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb']
     main_dtb = None
     tout.Info("   Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name)
     for etype, value in image.GetFdts().items():
@@ -240,7 +239,7 @@ def PrepareFromLoadedData(image):
         if 'multiple-images' in image_node.props:
             image_node = dtb.GetNode('/binman/%s' % image.image_node)
         fdt_path_prefix = image_node.path
-        output_fdt_info[etype] = [dtb, None, entry]
+        output_fdt_info[etype] = [dtb, None]
     tout.Info("   FDT path prefix '%s'" % fdt_path_prefix)
 
 
@@ -275,12 +274,11 @@ def GetUpdateNodes(node, for_repack=False):
             is node, SPL and TPL)
     """
     yield node
-    for dtb, fname, entry in output_fdt_info.values():
+    for entry_type, (dtb, fname) in output_fdt_info.items():
         if dtb != node.GetFdt():
-            if for_repack and entry.etype != 'u-boot-dtb':
+            if for_repack and entry_type != 'u-boot-dtb':
                 continue
             other_node = dtb.GetNode(fdt_path_prefix + node.path)
-            #print('   try', fdt_path_prefix + node.path, other_node)
             if other_node:
                 yield other_node
 
-- 
2.31.0.rc2.261.g7f71774620-goog

  parent reply	other threads:[~2021-03-18  7:25 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18  7:24 [PATCH v3 00/27] binman: Support devicetree update in all entries Simon Glass
2021-03-18  7:24 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass
2021-03-18  7:24 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
2021-03-18  7:24 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
2021-03-18  7:24 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
2021-03-18  7:24 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
2021-03-18  7:24 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
2021-03-18  7:24 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
2021-03-18  7:24 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
2021-03-18  7:24 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
2021-03-18  7:25 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
2021-03-18  7:25 ` Simon Glass [this message]
2021-03-18  7:25 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
2021-03-18  7:25 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
2021-03-18  7:25 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
2021-03-18  7:25 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
2021-03-18  7:25 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
2021-03-18  7:25 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
2021-03-18  7:25 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
2021-03-18  7:25 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
2021-03-18  7:25 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
2021-03-18  7:25 ` [PATCH v3 21/27] doc: Move UEFI under develop/ Simon Glass
2021-03-18  9:23   ` Heinrich Schuchardt
2021-03-19 23:52   ` Simon Glass
2021-03-18  7:25 ` [PATCH v3 22/27] doc: Move driver model docs " Simon Glass
2021-03-18  7:25 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
2021-03-18  7:25 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
2021-03-18  7:25 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
2021-03-18  7:25 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
2021-03-18  7:25 ` [PATCH v3 27/27] binman: Update various pieces of the documentation Simon Glass
2021-03-19 23:52 ` Simon Glass
2021-03-19 23:52 ` [PATCH v3 26/27] binman: Drop repetitive heading for each entry Simon Glass
2021-03-19 23:52 ` [PATCH v3 25/27] binman: Incorporate entry documentation Simon Glass
2021-03-19 23:52 ` [PATCH v3 24/27] binman: Rearrange documentation into headings Simon Glass
2021-03-19 23:52 ` [PATCH v3 23/27] binman: doc: Add documentation to htmldocs Simon Glass
2021-03-19 23:52 ` [PATCH v3 22/27] doc: Move driver model docs under develop/ Simon Glass
2021-03-19 23:52 ` [PATCH v3 20/27] x86: dts: Drop unused CONFIG_SPL Simon Glass
2021-03-19 23:52 ` [PATCH v3 19/27] x86: Make use of binman expanded entries Simon Glass
2021-03-19 23:52 ` [PATCH v3 18/27] Makefile: Pass new entry args to binman Simon Glass
2021-03-19 23:52 ` [PATCH v3 17/27] binman: Automatically expand phase binaries into sections Simon Glass
2021-03-19 23:52 ` [PATCH v3 16/27] binman: Plumb expanded entries through fully Simon Glass
2021-03-19 23:52 ` [PATCH v3 15/27] binman: Allow a way to select expanded entries Simon Glass
2021-03-19 23:52 ` [PATCH v3 14/27] binman: Allow using an an 'expanded' entry type Simon Glass
2021-03-19 23:52 ` [PATCH v3 13/27] binman: Use standard filenames for SPL/TPL devicetree Simon Glass
2021-03-19 23:52 ` [PATCH v3 12/27] binman: Move the comment for GetFdts() to the base class Simon Glass
2021-03-19 23:52 ` [PATCH v3 11/27] binman: Drop unnecessary field in output_fdt_info Simon Glass
2021-03-19 23:52 ` [PATCH v3 10/27] binman: Use the fake SPL/TPL only if requested Simon Glass
2021-03-19 23:53 ` [PATCH v3 09/27] binman: Drop unnecessary 'type' property in tests Simon Glass
2021-03-19 23:53 ` [PATCH v3 08/27] binman: Add support for u-boot-tpl-bss-bad Simon Glass
2021-03-19 23:53 ` [PATCH v3 07/27] binman: Add support for u-boot-tpl-nodtb Simon Glass
2021-03-19 23:53 ` [PATCH v3 06/27] binman: Support symbols in u-boot-spl-nodtb Simon Glass
2021-03-19 23:53 ` [PATCH v3 05/27] binman: Correct the documentation for u-boot-spl-bss-pad Simon Glass
2021-03-19 23:53 ` [PATCH v3 04/27] binman: Tidy up underscores in entry documentation Simon Glass
2021-03-19 23:53 ` [PATCH v3 03/27] binman: Update entry help for files-align Simon Glass
2021-03-19 23:53 ` [PATCH v3 02/27] binman: Document ExpandEntries() in the base class Simon Glass
2021-03-19 23:53 ` [PATCH v3 01/27] binman: Allow extracting to current directory Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210318072517.26894-12-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.