lkml.org 
[lkml]   [2023]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 04/16] lib/string_choices: Add str_input_output() helper
Date
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
\
 
 \ /
  Last update: 2023-03-27 00:46    [W:0.297 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site