summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-02-10 14:09:49 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-19 09:18:05 +0100
commitc6250f94edb7765d0cff198cb0ac87f75e556276 (patch)
tree4f2fa4b178a7b62bbae99146573aeaa653decc8a
parentc9322d4feab59fc4d05996d2c3d02eae50336be0 (diff)
downloadbarebox-c6250f94edb7765d0cff198cb0ac87f75e556276.tar.gz
reset_source: introduce reset_source_to_string
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_to_string, so drivers can be migrated to use it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/reset_source.c6
-rw-r--r--include/reset_source.h9
2 files changed, 10 insertions, 5 deletions
diff --git a/common/reset_source.c b/common/reset_source.c
index 8fdf052..343dc08 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_to_string(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_to_string);
int reset_source_get_instance(void)
{
diff --git a/include/reset_source.h b/include/reset_source.h
index 8795029..023b1fe 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -24,7 +24,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_to_string(enum reset_src_type st);
int reset_source_get_instance(void);
struct device_d *reset_source_get_device(void);
@@ -41,7 +41,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_to_string(enum reset_src_type st)
{
return "unknown";
}
@@ -89,4 +89,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_to_string(reset_source_get());
+}
+
#endif /* __INCLUDE_RESET_SOURCE_H */