mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] reset_source: add reset_source_get
Date: Mon, 27 Jan 2014 10:44:21 +0100	[thread overview]
Message-ID: <1390815861-30321-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1390815861-30321-1-git-send-email-s.hauer@pengutronix.de>

To get reset_source from C code, not only from shell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/reset_source.c  | 10 ++++++++++
 include/reset_source.h |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/common/reset_source.c b/common/reset_source.c
index 3a11d26..6026af1 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -27,8 +27,18 @@ static const char * const reset_src_names[] = {
 	[RESET_JTAG] = "JTAG",
 };
 
+static enum reset_src_type reset_source;
+
+enum reset_src_type reset_source_get(void)
+{
+	return reset_source;
+}
+EXPORT_SYMBOL(reset_source_get);
+
 void reset_source_set(enum reset_src_type st)
 {
+	reset_source = st;
+
 	setenv("global.system.reset", reset_src_names[st]);
 }
 EXPORT_SYMBOL(reset_source_set);
diff --git a/include/reset_source.h b/include/reset_source.h
index f3a203a..bff7f97 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -24,10 +24,16 @@ enum reset_src_type {
 
 #ifdef CONFIG_RESET_SOURCE
 void reset_source_set(enum reset_src_type);
+enum reset_src_type reset_source_get(void);
 #else
 static inline void reset_source_set(enum reset_src_type unused)
 {
 }
+
+static inline enum reset_src_type reset_source_get(void)
+{
+	return RESET_UKWN;
+}
 #endif
 
 #endif /* __INCLUDE_RESET_SOURCE_H */
-- 
1.8.5.2


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

      reply	other threads:[~2014-01-27  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27  9:44 [PATCH 1/2] reset_source: rename set_reset_source to reset_source_set Sascha Hauer
2014-01-27  9:44 ` Sascha Hauer [this message]

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=1390815861-30321-2-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