summaryrefslogtreecommitdiff
path: root/include/linux/string_choices.h
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-03-06 22:55:43 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-06-12 20:14:22 +0300
commita9fc76645ca02a79ab491e2b05e29dc222b1f6b4 (patch)
treefa97d89e126045a4ee491cd99c79cd12d3905f14 /include/linux/string_choices.h
parentfca76071bab2304b379c35674d3b9e36a82e364a (diff)
downloadlinux-a9fc76645ca02a79ab491e2b05e29dc222b1f6b4.tar.xz
lib/string_choices: Add str_high_low() helper
Add str_high_low() helper to return 'high' or 'low' string literal. Also add an inversed variant, i.e. str_low_high(). All the same for str_hi_low(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'include/linux/string_choices.h')
-rw-r--r--include/linux/string_choices.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index b7e7b9fd098c..48120222b9b2 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -14,6 +14,18 @@ static inline const char *str_enabled_disabled(bool v)
return v ? "enabled" : "disabled";
}
+static inline const char *str_hi_lo(bool v)
+{
+ return v ? "hi" : "lo";
+}
+#define str_lo_hi(v) str_hi_lo(!(v))
+
+static inline const char *str_high_low(bool v)
+{
+ return v ? "high" : "low";
+}
+#define str_low_high(v) str_high_low(!(v))
+
static inline const char *str_read_write(bool v)
{
return v ? "read" : "write";