summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-08-15 08:50:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-08-16 08:40:37 +0200
commit775ba3c093be186d345ab7132116fd0ed3e53ba2 (patch)
tree2f24e9eab96d5846c6403fe9dc3547edb9ea91a3 /common
parentb986f4f1ee4881c4c1d81738cf9f0366381f7066 (diff)
downloadbarebox-775ba3c093be186d345ab7132116fd0ed3e53ba2.tar.gz
introduce barebox_set_model
Instead of calling of_get_model() in barebox_get_model() add a barebox_set_model() and use it to set the boardinfo once it's available from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/misc.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/common/misc.c b/common/misc.c
index 14c3304..bb7d447 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -18,6 +18,7 @@
#include <common.h>
#include <errno.h>
+#include <malloc.h>
int errno;
EXPORT_SYMBOL(errno);
@@ -126,19 +127,25 @@ EXPORT_SYMBOL(perror);
void (*do_execute)(void *func, int argc, char *argv[]);
EXPORT_SYMBOL(do_execute);
-static const char *model;
+static char *model;
+
+/*
+ * The model is the verbose name of a board. It can contain
+ * whitespaces, uppercase/lowcer letters, digits, ',', '.'
+ * '-', '_'
+ */
+void barebox_set_model(const char *__model)
+{
+ free(model);
+ model = xstrdup(__model);
+}
+EXPORT_SYMBOL(barebox_set_model);
const char *barebox_get_model(void)
{
if (model)
return model;
- model = of_get_model();
- if (model)
- model = xstrdup(model);
- else
- model = CONFIG_BOARDINFO;
-
- return model;
+ return CONFIG_BOARDINFO;
}
EXPORT_SYMBOL(barebox_get_model);