On 4/14/21 3:00 PM, Bastian Krause wrote:
> From: Ahmad Fatoum <a.fat...@pengutronix.de>
> 
> Currently the /chosen fixups of "reset-source",
> "reset-source-instance", "reset-source-device" and "bootsource" do not
> happen if no bootargs are available.
> 
> Fix that by moving the actual bootargs fixup to a dedicated function
> of_write_bootargs() and only return there early on empty bootargs, but
> still perform the /chosen fixups mentioned above.
> 
> Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
> [bst: dropped new line deletions and modified string comparison, moved 
> of_write_bootargs() call to original position, add commit message]
> Signed-off-by: Bastian Krause <b...@pengutronix.de>
> ---
> No changes since (implicit) v1.
> ---
>  common/oftree.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)

Gentle ping.

> 
> diff --git a/common/oftree.c b/common/oftree.c
> index 075b9d6b8b..a8e6587a61 100644
> --- a/common/oftree.c
> +++ b/common/oftree.c
> @@ -161,16 +161,12 @@ static void watchdog_build_bootargs(struct watchdog 
> *watchdog, struct device_nod
>       free(buf);
>  }
>  
> -static int of_fixup_bootargs(struct device_node *root, void *unused)
> +static int of_write_bootargs(struct device_node *node)
>  {
> -     struct device_node *node;
>       const char *str;
> -     int err;
> -     int instance = reset_source_get_instance();
> -     struct device_d *dev;
>  
>       if (IS_ENABLED(CONFIG_SYSTEMD_OF_WATCHDOG))
> -             watchdog_build_bootargs(boot_get_enabled_watchdog(), root);
> +             watchdog_build_bootargs(boot_get_enabled_watchdog(), 
> of_get_parent(node));
>  
>       str = linux_bootargs_get();
>       if (!str)
> @@ -180,13 +176,23 @@ static int of_fixup_bootargs(struct device_node *root, 
> void *unused)
>       if (strlen(str) == 0)
>               return 0;
>  
> +     return of_property_write_string(node, "bootargs", str);
> +}
> +
> +static int of_fixup_bootargs(struct device_node *root, void *unused)
> +{
> +     struct device_node *node;
> +     int err;
> +     int instance = reset_source_get_instance();
> +     struct device_d *dev;
> +
>       node = of_create_node(root, "/chosen");
>       if (!node)
>               return -ENOMEM;
>  
>       of_property_write_string(node, "barebox-version", release_string);
>  
> -     err = of_property_write_string(node, "bootargs", str);
> +     err = of_write_bootargs(node);
>       if (err)
>               return err;
>  
> 


-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to