mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/4] reset_source: introduce reset_source_xlate to translate specific type
Date: Mon, 10 Feb 2020 14:09:49 +0100	[thread overview]
Message-ID: <20200210130952.19779-1-a.fatoum@pengutronix.de> (raw)

We have a few places where driver code prints reset_source_name() to
console after setting the reset source.

This working is probe order dependent, because reset_source_name()
prints the highest priority reset_source so far, which doesn't
necessarily have to be the one that was just computed.

Implement reset_source_xlate, so drivers can be migrated to use it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/reset_source.c  | 6 +++---
 include/reset_source.h | 9 +++++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/common/reset_source.c b/common/reset_source.c
index 8fdf05215753..e8da8da19aee 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -42,11 +42,11 @@ enum reset_src_type reset_source_get(void)
 }
 EXPORT_SYMBOL(reset_source_get);
 
-const char *reset_source_name(void)
+const char *reset_source_xlate(enum reset_src_type st)
 {
-	return reset_src_names[reset_source];
+	return reset_src_names[st];
 }
-EXPORT_SYMBOL(reset_source_name);
+EXPORT_SYMBOL(reset_source_xlate);
 
 int reset_source_get_instance(void)
 {
diff --git a/include/reset_source.h b/include/reset_source.h
index 305dde0102d5..914b9ef38458 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -28,7 +28,7 @@ enum reset_src_type {
 #ifdef CONFIG_RESET_SOURCE
 
 enum reset_src_type reset_source_get(void);
-const char *reset_source_name(void);
+const char *reset_source_xlate(enum reset_src_type st);
 int reset_source_get_instance(void);
 struct device_d *reset_source_get_device(void);
 
@@ -45,7 +45,7 @@ static inline enum reset_src_type reset_source_get(void)
 	return RESET_UKWN;
 }
 
-static inline const char *reset_source_name(void)
+static inline const char *reset_source_xlate(enum reset_src_type st)
 {
 	return "unknown";
 }
@@ -93,4 +93,9 @@ static inline void reset_source_set(enum reset_src_type type)
 	reset_source_set_priority(type, RESET_SOURCE_DEFAULT_PRIORITY);
 }
 
+static inline const char *reset_source_name(void)
+{
+	return reset_source_xlate(reset_source_get());
+}
+
 #endif /* __INCLUDE_RESET_SOURCE_H */
-- 
2.25.0


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

             reply	other threads:[~2020-02-10 13:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 13:09 Ahmad Fatoum [this message]
2020-02-10 13:09 ` [PATCH 2/4] watchdog: f71808e: only print reset reason if one's indicated Ahmad Fatoum
2020-02-10 13:09 ` [PATCH 3/4] reset_source: migrate from reset_source_name to reset_source_xlate Ahmad Fatoum
2020-02-10 13:09 ` [PATCH 4/4] reset: stm32: migrate restart reason and handler from stm32_iwdg Ahmad Fatoum
2020-02-19  8:24 ` [PATCH 1/4] reset_source: introduce reset_source_xlate to translate specific type 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=20200210130952.19779-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@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