diff mbox series

[v2,linux-next,2/2] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper

Message ID 20241119021719.7659-3-prosunofficial@gmail.com (mailing list archive)
State New
Headers show
Series lib/string_choices: Sorting function order | expand

Commit Message

R Sundar Nov. 19, 2024, 2:17 a.m. UTC
Add str_locked_unlocked()/str_unlocked_locked() helper to return
"locked" or "unlocked" string literal.

Suggested-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: R Sundar <prosunofficial@gmail.com>
---
 include/linux/string_choices.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index f3ba4f52ff26..a6bbf4e42c13 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -41,6 +41,12 @@  static inline const char *str_high_low(bool v)
 }
 #define str_low_high(v)		str_high_low(!(v))
 
+static inline const char *str_locked_unlocked(bool v)
+{
+	return v ? "locked" : "unlocked";
+}
+#define str_unlocked_locked(v)         str_locked_unlocked(!(v))
+
 static inline const char *str_on_off(bool v)
 {
 	return v ? "on" : "off";