mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] fixup! bootsource: add optional read of /chosen/bootsource
Date: Fri, 11 Apr 2025 09:13:24 +0200	[thread overview]
Message-ID: <Z_jBFLN1_fRtqeti@pengutronix.de> (raw)
In-Reply-To: <20250410112530.2711299-1-a.fatoum@pengutronix.de>

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.fatoum@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 |



      reply	other threads:[~2025-04-11  7:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10 11:25 Ahmad Fatoum
2025-04-11  7:13 ` Sascha Hauer [this message]

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=Z_jBFLN1_fRtqeti@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=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