mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 01/10] usbgadget: autostart: support delayed usbgadget.autostart=1
Date: Mon, 28 Sep 2020 16:45:05 +0200	[thread overview]
Message-ID: <20200928144514.14398-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200928144514.14398-1-a.fatoum@pengutronix.de>

So far, global.usbgadget.autostart=1 from the shell was without effect,
because the variable is only evaluated once at postenvironment_initcall.

Use the new globalvar_add_bool() to allow acting on the variable being
true at any time. This is necessary for scripts that want to enable
the usbgadget autostart functionality selectively without themselves
hardcoding the particularities of what is exported.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/usbgadget.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/usbgadget.c b/common/usbgadget.c
index b4f4ba04ca8c..be2bcc467d72 100644
--- a/common/usbgadget.c
+++ b/common/usbgadget.c
@@ -101,7 +101,7 @@ int usbgadget_register(bool dfu, const char *dfu_opts,
 	return ret;
 }
 
-static int usbgadget_autostart(void)
+static int usbgadget_autostart_set(struct param_d *param, void *ctx)
 {
 	bool fastboot_bbu = get_fastboot_bbu();
 
@@ -110,12 +110,12 @@ static int usbgadget_autostart(void)
 
 	return usbgadget_register(true, NULL, true, NULL, acm, fastboot_bbu);
 }
-postenvironment_initcall(usbgadget_autostart);
 
 static int usbgadget_globalvars_init(void)
 {
 	if (IS_ENABLED(CONFIG_USB_GADGET_AUTOSTART)) {
-		globalvar_add_simple_bool("usbgadget.autostart", &autostart);
+		globalvar_add_bool("usbgadget.autostart", usbgadget_autostart_set,
+				   &autostart, NULL);
 		globalvar_add_simple_bool("usbgadget.acm", &acm);
 	}
 	globalvar_add_simple_string("usbgadget.dfu_function", &dfu_function);
-- 
2.28.0


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

  reply	other threads:[~2020-09-28 14:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 14:45 [PATCH v2 00/10] power: reset: add support for syscon reboot Ahmad Fatoum
2020-09-28 14:45 ` Ahmad Fatoum [this message]
2020-09-28 14:45 ` [PATCH v2 02/10] drivers: add reboot-mode infrastructure Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 03/10] power: reset: reboot-mode: port syscon-reboot-mode support Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 04/10] power: reset: reboot-mode: fix up node into boot device tree Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 05/10] defaultenv: provide defaults for generic reboot modes Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 06/10] ARM: dts: stm32mp: setup syscon-reboot-mode on TAMP general purpose register Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 07/10] ARM: stm32mp: remove custom reboot mode logic from arch code Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 08/10] power: reset: reboot-mode: support multi-word magic Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 09/10] power: reset: syscon-reboot-mode: support multi-word reboot modes Ahmad Fatoum
2020-09-28 14:45 ` [PATCH v2 10/10] ARM: dts: i.MX6qdl: define BootROM reboot-mode on top of SRC_GPR{9, 10} Ahmad Fatoum
2020-09-29  8:25 ` [PATCH v2 00/10] power: reset: add support for syscon reboot Sascha Hauer

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=20200928144514.14398-2-a.fatoum@pengutronix.de \
    --to=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