[PATCH 1/6] globalvar: Allow to remove globalvars
Sascha Hauer
s.hauer at pengutronix.de
Fri Apr 29 02:52:00 PDT 2016
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
common/globalvar.c | 10 ++++++++++
include/globalvar.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/common/globalvar.c b/common/globalvar.c
index 9a793ac..05c3e79 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -33,6 +33,16 @@ int globalvar_add(const char *name,
return 0;
}
+void globalvar_remove(const char *name)
+{
+ struct param_d *param = get_param_by_name(&global_device, name);
+
+ if (!param)
+ return;
+
+ dev_remove_param(param);
+}
+
static int nv_save(const char *name, const char *val)
{
int fd, ret;
diff --git a/include/globalvar.h b/include/globalvar.h
index e77209b..d0c79c0 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -14,6 +14,7 @@ int globalvar_add(const char *name,
int (*set)(struct device_d *dev, struct param_d *p, const char *val),
const char *(*get)(struct device_d *, struct param_d *p),
unsigned long flags);
+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);
--
2.8.0.rc3
More information about the barebox
mailing list