[PATCH v1 04/16] lib/string_choices: Add str_input_output() helper

Andy Shevchenko
2023-03-06T19:55:49Z

Add str_input_output() helper to return 'input' or 'output' string literal.
Also add an inversed variant, i.e. str_output_input().

All the same for str_in_out().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/string_choices.h | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index 48120222b9b2..ad345df325ec 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -26,6 +26,18 @@ static inline const char *str_high_low(bool v)
}
#define str_low_high(v) str_high_low(!(v))

+static inline const char *str_in_out(bool v)
+{
+ return v ? "in" : "out";
+}
+#define str_out_in(v) str_in_out(!(v))
+
+static inline const char *str_input_output(bool v)
+{
+ return v ? "input" : "output";
+}
+#define str_output_input(v) str_input_output(!(v))
+
static inline const char *str_read_write(bool v)
{
return v ? "read" : "write";
--
2.39.1