[PATCH] lib/string_choices: add str_pass_fail() and str_passed_failed()
From: Dmitry Antipov
Date: Wed Aug 19 2026 - 10:43:34 EST
Looking over a few kernel subsystems I'm currently working on,
I suppose that 'str_pass_fail()' and 'str_passed_failed()' with
their opposite counterpart macros may be useful as well.
Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
---
include/linux/string_choices.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index ee84087d4b26..901ab80bfdd7 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -59,6 +59,20 @@ static inline const char *str_on_off(bool v)
}
#define str_off_on(v) str_on_off(!(v))
+static inline const char *str_pass_fail(bool v)
+{
+ return v ? "pass" : "fail";
+}
+
+#define str_fail_pass(v) str_pass_fail(!(v))
+
+static inline const char *str_passed_failed(bool v)
+{
+ return v ? "passed" : "failed";
+}
+
+#define str_failed_passed(v) str_passed_failed(!(v))
+
static inline const char *str_read_write(bool v)
{
return v ? "read" : "write";
--
2.55.0