From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! bootsource: add optional read of /chosen/bootsource
Date: Thu, 10 Apr 2025 13:25:30 +0200 [thread overview]
Message-ID: <20250410112530.2711299-1-a.fatoum@pengutronix.de> (raw)
bootsource: read out /chosen/bootsource earlier
While late initcall is early enough for shell scripts to see a correct
$bootsource, it's usually too late for board code.
As device trees are registered in core_initcall usually, let's parse the
property at postcore time instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/of/base.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 324565068771..8184b284099e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -3592,29 +3592,28 @@ const char *of_get_machine_compatible(void)
}
EXPORT_SYMBOL(of_get_machine_compatible);
-static void of_init_bootsource(void)
+static int of_init_early_vars(void)
{
struct device_node *bootsource;
if (!IS_ENABLED(CONFIG_BAREBOX_DT_2ND))
- return;
+ return 0;
bootsource = of_find_node_by_chosen("bootsource", NULL);
- if (!bootsource)
- return;
+ if (bootsource)
+ bootsource_of_node_set(bootsource);
- bootsource_of_node_set(bootsource);
+ return 0;
}
+postcore_initcall(of_init_early_vars);
-static int of_init_vars(void)
+static int of_init_late_vars(void)
{
const char *name;
name = of_get_machine_compatible();
barebox_set_hostname_no_overwrite(name ?: "barebox");
- of_init_bootsource();
-
return 0;
}
-late_initcall(of_init_vars);
+late_initcall(of_init_late_vars);
--
2.39.5
next reply other threads:[~2025-04-10 11:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 11:25 Ahmad Fatoum [this message]
2025-04-11 7:13 ` 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=20250410112530.2711299-1-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