Add str_to_from() helper to return "to" or "from" string literal.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto...@renesas.com>
---
 include/linux/string_choices.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index d52ced93e21e..e07a9a5e403e 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -107,6 +107,12 @@ static inline const char *str_pass_fail(bool v)
 }
 #define str_fail_pass(v)       str_pass_fail(!(v))
 
+static inline const char *str_to_from(bool v)
+{
+       return v ? "to" : "from";
+}
+#define str_from_to(v)         str_to_from(!(v))
+
 /**
  * str_plural - Return the simple pluralization based on English counts
  * @num: Number used for deciding pluralization
-- 
2.43.0


Reply via email to