summaryrefslogtreecommitdiff
path: root/include/linux/string_choices.h
diff options
context:
space:
mode:
authorMichal Wajdeczko <michal.wajdeczko@intel.com>2024-07-25 13:18:40 +0300
committerKees Cook <kees@kernel.org>2024-08-15 19:26:02 +0300
commita98ae7f045b29de4f48b191d5aeb4e803183d759 (patch)
treefa963067388c55dfdf7b16b21b0d8d1d8536c920 /include/linux/string_choices.h
parent9c6b7fbbd7a2c2772a592adf9b2835371927a1d3 (diff)
downloadlinux-a98ae7f045b29de4f48b191d5aeb4e803183d759.tar.xz
lib/string_choices: Add str_up_down() helper
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>
Diffstat (limited to 'include/linux/string_choices.h')
-rw-r--r--include/linux/string_choices.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index d9ebe20229f8..bcde3c9cff81 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -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