]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lib/string_choices: Add str_up_down() helper
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 25 Jul 2024 10:18:40 +0000 (12:18 +0200)
committerKees Cook <kees@kernel.org>
Thu, 15 Aug 2024 16:26:02 +0000 (09:26 -0700)
Add str_up_down() helper to return "up" or "down" string literal.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://lore.kernel.org/r/20240725101841.574-1-michal.wajdeczko@intel.com
Signed-off-by: Kees Cook <kees@kernel.org>
include/linux/string_choices.h

index d9ebe20229f810d1f002c14ef0e918a0a851123d..bcde3c9cff81f59c8a299f8f18e2cf26ecf26d4e 100644 (file)
@@ -42,6 +42,11 @@ static inline const char *str_yes_no(bool v)
        return v ? "yes" : "no";
 }
 
+static inline const char *str_up_down(bool v)
+{
+       return v ? "up" : "down";
+}
+
 /**
  * str_plural - Return the simple pluralization based on English counts
  * @num: Number used for deciding pluralization