On Thu, Apr 10, 2025 at 01:25:30PM +0200, Ahmad Fatoum wrote: > 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.fat...@pengutronix.de> > --- > drivers/of/base.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-)
Applied, thanks Sascha > > 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 > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |