mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/7] fip: mark predefined toc_entries array const
Date: Wed,  9 Apr 2025 16:01:30 +0200	[thread overview]
Message-ID: <20250409140134.2079552-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250409140134.2079552-1-a.fatoum@pengutronix.de>

There is no use case for modifying these mapping structure used by the
fiptool command, so mark them appropriately.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/fiptool.c | 4 ++--
 include/fiptool.h  | 4 ++--
 lib/fip.c          | 2 +-
 lib/tbbr_config.c  | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/commands/fiptool.c b/commands/fiptool.c
index 46b5ed29c317..ccf99491bf66 100644
--- a/commands/fiptool.c
+++ b/commands/fiptool.c
@@ -115,9 +115,9 @@ static int info_cmd(struct fip_state *fip, int argc, char *argv[])
 
 static int uuid_cmd(struct fip_state *fip, int argc, char *argv[])
 {
-	for (toc_entry_t *t = toc_entries; t->cmdline_name != NULL; t++)
+	for (const toc_entry_t *t = toc_entries; t->cmdline_name != NULL; t++)
 		printf("%pU\t%-16s\t%s\n", &t->uuid, t->cmdline_name, t->name);
-	for (toc_entry_t *t = plat_def_toc_entries; t->cmdline_name != NULL; t++)
+	for (const toc_entry_t *t = plat_def_toc_entries; t->cmdline_name != NULL; t++)
 		printf("%pU\t%-16s\t%s\n", &t->uuid, t->cmdline_name, t->name);
 	return 0;
 }
diff --git a/include/fiptool.h b/include/fiptool.h
index 1b70824a8694..1a0dbe0e6975 100644
--- a/include/fiptool.h
+++ b/include/fiptool.h
@@ -91,8 +91,8 @@ typedef struct toc_entry {
 	char         *cmdline_name;
 } toc_entry_t;
 
-extern toc_entry_t toc_entries[];
-extern toc_entry_t plat_def_toc_entries[];
+extern const toc_entry_t toc_entries[];
+extern const toc_entry_t plat_def_toc_entries[];
 
 #define fip_for_each_desc(fip, e) \
         list_for_each_entry(e, &(fip)->descs, list)
diff --git a/lib/fip.c b/lib/fip.c
index f3754bdc29af..9470aa5d3398 100644
--- a/lib/fip.c
+++ b/lib/fip.c
@@ -105,7 +105,7 @@ void fip_free(struct fip_state *fip)
 
 void fip_fill_image_descs(struct fip_state *fip)
 {
-	toc_entry_t *toc_entry;
+	const toc_entry_t *toc_entry;
 
 	for (toc_entry = toc_entries;
 	     toc_entry->cmdline_name != NULL;
diff --git a/lib/tbbr_config.c b/lib/tbbr_config.c
index 3d777e5648a9..9e5f51029beb 100644
--- a/lib/tbbr_config.c
+++ b/lib/tbbr_config.c
@@ -5,7 +5,7 @@
 #include <fiptool.h>
 
 /* The images used depends on the platform. */
-toc_entry_t toc_entries[] = {
+const toc_entry_t toc_entries[] = {
 	{
 		.name = "SCP Firmware Updater Configuration FWU SCP_BL2U",
 		.uuid = UUID_TRUSTED_UPDATE_FIRMWARE_SCP_BL2U,
@@ -187,7 +187,7 @@ toc_entry_t toc_entries[] = {
 	}
 };
 
-toc_entry_t plat_def_toc_entries[] = {
+const toc_entry_t plat_def_toc_entries[] = {
 #ifdef CONFIG_ARCH_STM32MP
 	{
 		.name = "STM32MP CONFIG CERT",
-- 
2.39.5




  parent reply	other threads:[~2025-04-09 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 14:01 [PATCH 0/7] ARM: add support for chainloading barebox inside FIP images Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 1/7] fip: add struct fip_image_desc::private_data Ahmad Fatoum
2025-04-09 14:01 ` Ahmad Fatoum [this message]
2025-04-09 14:01 ` [PATCH 3/7] bootm: implement UIMAGE_IS_ADDRESS_VALID helper Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 4/7] ARM: legacy: make architecture number unsigned Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 5/7] ARM: introduce jump_to_linux helper Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 6/7] ARM: add support for chainloading barebox inside FIP images Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 7/7] ARM: stm32mp: retire non-FIP stm32mp_bbu_mmc_register_handler Ahmad Fatoum

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=20250409140134.2079552-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox