mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] reset_source: introduce reset_source_xlate to translate specific type
@ 2020-02-10 13:09 Ahmad Fatoum
  2020-02-10 13:09 ` [PATCH 2/4] watchdog: f71808e: only print reset reason if one's indicated Ahmad Fatoum
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-02-10 13:09 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-19  8:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 13:09 [PATCH 1/4] reset_source: introduce reset_source_xlate to translate specific type Ahmad Fatoum
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox