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 4/4] startup: set barebox_main in data section
Date: Mon, 16 Dec 2024 12:36:40 +0100	[thread overview]
Message-ID: <20241216113640.403845-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241216113640.403845-1-a.fatoum@pengutronix.de>

By initializing barebox_main in start_barebox(), we preclude changing
barebox_main before start_barebox() is called.

This can be useful, at least in sandbox. Therefore, let's initialize
barebox_main statically.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/startup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 4cb9cfcdaa49..898bef6d22e4 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -355,16 +355,15 @@ static void do_ctors(void)
 #endif
 }
 
-int (*barebox_main)(void);
+int (*barebox_main)(void)
+	= !IS_ENABLED(CONFIG_SHELL_NONE) &&
+           IS_ENABLED(CONFIG_COMMAND_SUPPORT) ? run_init : NULL;
 
 void __noreturn start_barebox(void)
 {
 	initcall_t *initcall;
 	int result;
 
-	if (!IS_ENABLED(CONFIG_SHELL_NONE) && IS_ENABLED(CONFIG_COMMAND_SUPPORT))
-		barebox_main = run_init;
-
 	do_ctors();
 
 	for (initcall = __barebox_initcalls_start;
-- 
2.39.5




  parent reply	other threads:[~2024-12-16 11:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 11:36 [PATCH 1/4] sandbox: add support for --loglevel option Ahmad Fatoum
2024-12-16 11:36 ` [PATCH 2/4] sandbox: add support for architecture-specific debug options Ahmad Fatoum
2024-12-16 11:36 ` [PATCH 3/4] sandbox: move CONFIG_ASAN to architecture Kconfig Ahmad Fatoum
2024-12-16 11:36 ` Ahmad Fatoum [this message]
2024-12-20  9:04 ` [PATCH 1/4] sandbox: add support for --loglevel option Sascha Hauer

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=20241216113640.403845-4-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