From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/8] introduce barebox_set_model
Date: Thu, 15 Aug 2013 09:28:58 +0200 [thread overview]
Message-ID: <1376551741-16438-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1376551741-16438-1-git-send-email-s.hauer@pengutronix.de>
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>
---
common/misc.c | 23 +++++++++++++++--------
drivers/of/base.c | 3 +++
include/common.h | 1 +
3 files changed, 19 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);
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4770421..8af51d4 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1610,6 +1610,9 @@ int of_probe(void)
of_chosen = of_find_node_by_path("/chosen");
of_property_read_string(root_node, "model", &of_model);
+ if (of_model)
+ barebox_set_model(of_model);
+
__of_parse_phandles(root_node);
memory = of_find_node_by_path("/memory");
diff --git a/include/common.h b/include/common.h
index 09b8c39..7d05d8b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -235,6 +235,7 @@ static inline void barebox_banner(void) {}
#endif
const char *barebox_get_model(void);
+void barebox_set_model(const char *);
#define IOMEM(addr) ((void __force __iomem *)(addr))
--
1.8.4.rc2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-08-15 7:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-15 7:28 [PATCH] move BOARDINFO to globalvar Sascha Hauer
2013-08-15 7:28 ` [PATCH 1/8] globalvar: Allow to set initial value Sascha Hauer
2013-08-15 7:28 ` [PATCH 2/8] Add a global.version variable Sascha Hauer
2013-08-15 7:28 ` [PATCH 3/8] globalvar: move globalvar init to pure_initcall Sascha Hauer
2013-08-15 7:28 ` [PATCH 4/8] remove remaining references of CONFIG_BOARDINFO Sascha Hauer
2013-08-15 7:28 ` Sascha Hauer [this message]
2013-08-15 7:28 ` [PATCH 6/8] Make hostname available to C Code Sascha Hauer
2013-08-15 7:29 ` [PATCH 7/8] Set model and hostname at boardlevel Sascha Hauer
2013-08-15 7:39 ` Alexander Shiyan
2013-08-15 9:13 ` Sascha Hauer
2013-08-15 9:07 ` Sebastian Hesselbarth
2013-08-15 9:13 ` Sascha Hauer
2013-08-15 9:19 ` Sebastian Hesselbarth
2013-08-15 7:29 ` [PATCH 8/8] export model as globalvar 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=1376551741-16438-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@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