mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] globalvar: add set_single function
@ 2020-09-12  7:12 Rouven Czerwinski
  2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Rouven Czerwinski @ 2020-09-12  7:12 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Instead of overwriting the whole hierarchy beneath a globalvar, the
set_single function only sets the specific globalvar.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 common/globalvar.c  | 11 +++++++++++
 include/globalvar.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index 98a028a68a..848a7d6832 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -399,6 +399,17 @@ void globalvar_set_match(const char *match, const char *val)
 	}
 }
 
+void globalvar_set_single(const char *match, const char *val)
+{
+	struct param_d *param;
+
+	list_for_each_entry(param, &global_device.parameters, list) {
+		if (!strncmp(match, param->name, strlen(match))
+		    && strlen(match) == strlen(param->name))
+			dev_set_param(&global_device, param->name, val);
+	}
+}
+
 static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
 {
 	struct device_d *rdev;
diff --git a/include/globalvar.h b/include/globalvar.h
index fc85e93e14..ceed020ff4 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -15,6 +15,7 @@ int globalvar_add_simple(const char *name, const char *value);
 void globalvar_remove(const char *name);
 char *globalvar_get_match(const char *match, const char *separator);
 void globalvar_set_match(const char *match, const char *val);
+void globalvar_set_single(const char *match, const char *val);
 
 int globalvar_add_simple_string(const char *name, char **value);
 int globalvar_add_simple_int(const char *name, int *value,
-- 
2.28.0


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

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 1/4] globalvar: add globalvar_set function
@ 2020-09-15  6:47 Rouven Czerwinski
  2020-09-15  6:47 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski
  0 siblings, 1 reply; 8+ messages in thread
From: Rouven Czerwinski @ 2020-09-15  6:47 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Instead of overwriting the whole hierarchy beneath a globalvar, the
globalvar_set function only sets the specific globalvar.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
v2:
- use the name directly to set the variable
- rename to globalvar_set

 common/globalvar.c  | 5 +++++
 include/globalvar.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index 98a028a68a..1219ceaeb3 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -399,6 +399,11 @@ void globalvar_set_match(const char *match, const char *val)
 	}
 }
 
+void globalvar_set(const char *name, const char *val)
+{
+	dev_set_param(&global_device, name, val);
+}
+
 static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const char *val)
 {
 	struct device_d *rdev;
diff --git a/include/globalvar.h b/include/globalvar.h
index fc85e93e14..956dda074a 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -15,6 +15,7 @@ int globalvar_add_simple(const char *name, const char *value);
 void globalvar_remove(const char *name);
 char *globalvar_get_match(const char *match, const char *separator);
 void globalvar_set_match(const char *match, const char *val);
+void globalvar_set(const char *name, const char *val);
 
 int globalvar_add_simple_string(const char *name, char **value);
 int globalvar_add_simple_int(const char *name, int *value,
-- 
2.28.0


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-15  6:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-12  7:12 [PATCH 1/4] globalvar: add set_single function Rouven Czerwinski
2020-09-12  7:12 ` [PATCH] iotmaxx: gw4100: WDOG_ANY as GPIO output Rouven Czerwinski
2020-09-12  7:15   ` Rouven Czerwinski
2020-09-12  7:12 ` [PATCH 2/4] blspec: only reset variable locations, not paths Rouven Czerwinski
2020-09-12  7:12 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski
2020-09-12  7:12 ` [PATCH 4/4] fastboot: only unset image, not loadaddr Rouven Czerwinski
2020-09-14  9:13 ` [PATCH 1/4] globalvar: add set_single function Sascha Hauer
2020-09-15  6:47 [PATCH 1/4] globalvar: add globalvar_set function Rouven Czerwinski
2020-09-15  6:47 ` [PATCH 3/4] blspec: fix bootm_data initialization Rouven Czerwinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox