mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] fastboot net: add global.fastboot.net.autostart early
Date: Thu, 12 Aug 2021 09:35:34 +0200	[thread overview]
Message-ID: <20210812073534.fg5f2cucub4rr3kv@pengutronix.de> (raw)
In-Reply-To: <9e266302-92a1-a577-d38c-fc240177b169@pengutronix.de>

Hi Ahmad,

On 21-08-11 20:22, Ahmad Fatoum wrote:
> 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?

Yes something like this. I have a custom board which calls
sentenv("global.fastboot.net.autostart", "1") during the
environment_initcall step.

But also I didn't get the logic behind: adding a global var in the same
function which checks that var to start the network interface.

Regards,
  Marco

> > Signed-off-by: Marco Felsch <m.felsch@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 |
> 

-- 
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	other threads:[~2021-08-12  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 17:25 Marco Felsch
2021-08-11 18:22 ` Ahmad Fatoum
2021-08-12  7:35   ` Marco Felsch [this message]
2021-08-12  8:54     ` Ahmad Fatoum

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=20210812073534.fg5f2cucub4rr3kv@pengutronix.de \
    --to=m.felsch@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