diff mbox series

[-next,1/2] lib/string_choices: Add str_true_false() helper

Message ID 20240823062046.3323694-2-lihongbo22@huawei.com (mailing list archive)
State Superseded
Headers show
Series Add str_true_false()/str_false_true() helper | expand

Commit Message

Hongbo Li Aug. 23, 2024, 6:20 a.m. UTC
Add str_true_false() helper to return "true" or "false"
string literal.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 include/linux/string_choices.h | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index 1320bcdcb89c..7c74497caf2b 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -48,6 +48,11 @@  static inline const char *str_up_down(bool v)
 }
 #define str_down_up(v)		str_up_down(!(v))
 
+static inline const char *str_true_false(bool v)
+{
+	return v ? "true" : "false";
+}
+
 /**
  * str_plural - Return the simple pluralization based on English counts
  * @num: Number used for deciding pluralization