[PATCH] fastboot net: add global.fastboot.net.autostart early

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Aug 11 11:22:15 PDT 2021


On 11.08.21 19:25, Marco Felsch wrote:
> Split adding the fastboot.net.autostart to the global device and make
> use of it. With this change it is possible to set it e.g. during
> environment_initcall() and the later on followed fastboot_on_boot() can
> use it to start fastboot it automatically during boot.

So what you fix here is use of global fastboot.net.autostart from within
init scripts, or what is your use case?

> 
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
> ---
>  net/fastboot.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/net/fastboot.c b/net/fastboot.c
> index df388adc89..a5a7caf526 100644
> --- a/net/fastboot.c
> +++ b/net/fastboot.c
> @@ -547,12 +547,16 @@ fail_generic_init:
>  static struct fastboot_net *fastboot_net_obj;
>  static int fastboot_net_autostart;
>  
> -static int fastboot_on_boot(void)
> +static int fastboot_net_globalvars_init(void)
>  {
> -	struct fastboot_net *fbn;
> -
>  	globalvar_add_simple_bool("fastboot.net.autostart",
>  				  &fastboot_net_autostart);
> +	return 0;
> +}
> +
> +static int fastboot_on_boot(void)
> +{
> +	struct fastboot_net *fbn;
>  
>  	if (!fastboot_net_autostart)
>  		return 0;
> @@ -573,6 +577,7 @@ static void fastboot_net_exit(void)
>  		fastboot_net_free(fastboot_net_obj);
>  }
>  
> +device_initcall(fastboot_net_globalvars_init);
>  postenvironment_initcall(fastboot_on_boot);
>  predevshutdown_exitcall(fastboot_net_exit);
>  
> 


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



More information about the barebox mailing list