All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Sean Edmond <seanedmond@microsoft.com>,
	Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Dhananjay Phadke <dphadke@linux.microsoft.com>,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>,
	Jerry Van Baren <vanbaren@cideas.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>
Subject: [PATCH 3/7] fdt: Improve the comment for fdt_shrink_to_minimum()
Date: Sun, 12 Nov 2023 08:27:46 -0700	[thread overview]
Message-ID: <20231112152754.130399-4-sjg@chromium.org> (raw)
In-Reply-To: <20231112152754.130399-1-sjg@chromium.org>

Add a bit more detail about what this function does.

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

 boot/fdt_support.c    |  1 -
 include/fdt_support.h | 12 +++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 09ce5828659e..510ad24a999d 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -722,7 +722,6 @@ int fdt_record_loadable(void *blob, u32 index, const char *name,
 	return node;
 }
 
-/* Resize the fdt to its actual size + a bit of padding */
 int fdt_shrink_to_minimum(void *blob, uint extrasize)
 {
 	int i;
diff --git a/include/fdt_support.h b/include/fdt_support.h
index d967118bedf0..791258ec7eff 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -242,13 +242,23 @@ int ft_system_setup(void *blob, struct bd_info *bd);
 void set_working_fdt_addr(ulong addr);
 
 /**
- * shrink down the given blob to minimum size + some extrasize if required
+ * fdt_shrink_to_minimum() - shrink FDT while allowing for some margin
+ *
+ * Shrink down the given blob to 'minimum' size + some extrasize.
+ *
+ * The new size is enough to hold the existing contents plus @extrasize bytes,
+ * plus 5 memory reservations. Also, the end of the FDT is aligned to a 4KB
+ * boundary, so it might end up up to 4KB larger than needed.
+ *
+ * If there is an existing memory reservation for @blob in the FDT, it is
+ * updated for the new size.
  *
  * @param blob		FDT blob to update
  * @param extrasize	additional bytes needed
  * Return: 0 if ok, or -FDT_ERR_... on error
  */
 int fdt_shrink_to_minimum(void *blob, uint extrasize);
+
 int fdt_increase_size(void *fdt, int add_len);
 
 int fdt_delete_disabled_nodes(void *blob);
-- 
2.42.0.869.gea05f2083d-goog


  parent reply	other threads:[~2023-11-12 15:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12 15:27 [PATCH 0/7] fdt: Move towards using ofnode for devicetree fixups Simon Glass
2023-11-12 15:27 ` [PATCH 1/7] boot: Drop size parameter from image_setup_libfdt() Simon Glass
2023-11-12 18:22   ` Tom Rini
2023-12-13 20:39   ` Simon Glass
2023-11-12 15:27 ` [PATCH 2/7] fdt: Check for a valid fdt in oftree_ensure() Simon Glass
2023-11-12 15:27 ` Simon Glass [this message]
2023-11-12 15:27 ` [PATCH 4/7] fdt: ppc: Drop extra size for ramdisk Simon Glass
2023-11-12 18:22   ` Tom Rini
2023-12-13 20:39   ` Simon Glass
2023-11-12 15:27 ` [PATCH 5/7] boot: Move adding initrd earlier in image_setup_libfdt() Simon Glass
2023-11-12 15:27 ` [PATCH 6/7] fdt: Drop the confusing casts in lmb_free() Simon Glass
2023-11-12 15:27 ` [PATCH 7/7] fdt: Move ft_verify_fdt() before the final fixups Simon Glass
2023-12-13 20:39 ` [PATCH 6/7] fdt: Drop the confusing casts in lmb_free() Simon Glass
2023-12-13 20:39 ` [PATCH 5/7] boot: Move adding initrd earlier in image_setup_libfdt() 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=20231112152754.130399-4-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=dphadke@linux.microsoft.com \
    --cc=hvilleneuve@dimonoff.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=seanedmond@microsoft.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vanbaren@cideas.com \
    /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.