summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/boot.c2
-rw-r--r--common/bootchooser.c4
-rw-r--r--common/bootm.c2
-rw-r--r--common/console_common.c6
-rw-r--r--common/globalvar.c28
-rw-r--r--common/password.c2
-rw-r--r--common/reset_source.c2
7 files changed, 30 insertions, 16 deletions
diff --git a/common/boot.c b/common/boot.c
index a2d27d1..cef3d5e 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -123,7 +123,7 @@ void boot_set_watchdog_timeout(unsigned int timeout)
static int init_boot_watchdog_timeout(void)
{
- return globalvar_add_simple_uint32("boot.watchdog_timeout",
+ return globalvar_add_simple_int("boot.watchdog_timeout",
&boot_watchdog_timeout, "%u");
}
late_initcall(init_boot_watchdog_timeout);
diff --git a/common/bootchooser.c b/common/bootchooser.c
index f6d99d1..455f290 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -907,8 +907,8 @@ static int bootchooser_init(void)
globalvar_add_simple_bool("bootchooser.retry", &retry);
globalvar_add_simple_string("bootchooser.targets", &available_targets);
globalvar_add_simple_string("bootchooser.state_prefix", &state_prefix);
- globalvar_add_simple_uint32("bootchooser.default_attempts", &global_default_attempts, "%u");
- globalvar_add_simple_uint32("bootchooser.default_priority", &global_default_priority, "%u");
+ globalvar_add_simple_int("bootchooser.default_attempts", &global_default_attempts, "%u");
+ globalvar_add_simple_int("bootchooser.default_priority", &global_default_priority, "%u");
globalvar_add_simple_bitmask("bootchooser.reset_attempts", &reset_attempts,
reset_attempts_names, ARRAY_SIZE(reset_attempts_names));
globalvar_add_simple_bitmask("bootchooser.reset_priorities", &reset_priorities,
diff --git a/common/bootm.c b/common/bootm.c
index 92cfeb6..81625d9 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -668,7 +668,7 @@ static int bootm_init(void)
if (IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES))
bootm_verify_mode = BOOTM_VERIFY_SIGNATURE;
- globalvar_add_simple_uint32("bootm.verbose", &bootm_verbosity, "%u");
+ globalvar_add_simple_int("bootm.verbose", &bootm_verbosity, "%u");
globalvar_add_simple_enum("bootm.verify", (unsigned int *)&bootm_verify_mode,
bootm_verify_names, ARRAY_SIZE(bootm_verify_names));
diff --git a/common/console_common.c b/common/console_common.c
index b36b3ff..d051458 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -148,10 +148,10 @@ int dev_printf(int level, const struct device_d *dev, const char *format, ...)
static int loglevel_init(void)
{
if (IS_ENABLED(CONFIG_LOGBUF))
- globalvar_add_simple_uint32("log_max_messages",
- &barebox_log_max_messages, "%u");
+ globalvar_add_simple_int("log_max_messages",
+ &barebox_log_max_messages, "%d");
- return globalvar_add_simple_uint32("loglevel", &barebox_loglevel, "%u");
+ return globalvar_add_simple_int("loglevel", &barebox_loglevel, "%d");
}
device_initcall(loglevel_init);
diff --git a/common/globalvar.c b/common/globalvar.c
index 2f65ca8..32ca6a2 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -424,7 +424,7 @@ int globalvar_add_simple(const char *name, const char *value)
return 0;
}
-int __globalvar_add_simple_string(const char *name, char **value)
+int globalvar_add_simple_string(const char *name, char **value)
{
struct param_d *p;
@@ -439,14 +439,28 @@ int __globalvar_add_simple_string(const char *name, char **value)
return 0;
}
-int __globalvar_add_simple_int(const char *name, void *value,
- enum param_type type,
- const char *format)
+int globalvar_add_simple_int(const char *name, int *value,
+ const char *format)
{
struct param_d *p;
- p = __dev_add_param_int(&global_device, name, NULL, NULL,
- value, type, format, NULL);
+ p = dev_add_param_int(&global_device, name, NULL, NULL,
+ value, format, NULL);
+
+ if (IS_ERR(p))
+ return PTR_ERR(p);
+
+ globalvar_nv_sync(name);
+
+ return 0;
+}
+
+int globalvar_add_simple_bool(const char *name, int *value)
+{
+ struct param_d *p;
+
+ p = dev_add_param_bool(&global_device, name, NULL, NULL,
+ value, NULL);
if (IS_ERR(p))
return PTR_ERR(p);
@@ -508,7 +522,7 @@ static int globalvar_init(void)
if (IS_ENABLED(CONFIG_NVVAR))
register_device(&nv_device);
- globalvar_add_simple_string_fixed("version", UTS_RELEASE);
+ globalvar_add_simple("version", UTS_RELEASE);
return 0;
}
diff --git a/common/password.c b/common/password.c
index 5e6bfc5..74d328f 100644
--- a/common/password.c
+++ b/common/password.c
@@ -443,7 +443,7 @@ static int login_global_init(void)
{
login_fail_command = xstrdup("boot");
- globalvar_add_simple_uint32("login.timeout", &login_timeout, "%u");
+ globalvar_add_simple_int("login.timeout", &login_timeout, "%d");
globalvar_add_simple_string("login.fail_command", &login_fail_command);
return 0;
diff --git a/common/reset_source.c b/common/reset_source.c
index e18bf6d..06e2ca8 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(reset_source_set_priority);
static int reset_source_init(void)
{
- globalvar_add_simple_enum_ro("system.reset", (unsigned int *)&reset_source,
+ globalvar_add_simple_enum("system.reset", (unsigned int *)&reset_source,
reset_src_names, ARRAY_SIZE(reset_src_names));
return 0;