]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
lib/string_choices: Add str_input_output() helper
authorThomas Richard <thomas.richard@bootlin.com>
Mon, 11 Aug 2025 13:25:52 +0000 (15:25 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 11 Aug 2025 13:39:31 +0000 (15:39 +0200)
Add str_input_output() helper to return 'input' or 'output' string literal.
Also add the inversed variant str_output_input().

Suggested-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20250811-aaeon-up-board-pinctrl-support-v9-9-29f0cbbdfb30@bootlin.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
include/linux/string_choices.h

index f3ba4f52ff2601f2eb5b974602dd075db2ff5d86..a27c87c954ae0de03cb804fdad6f490f2b003e13 100644 (file)
@@ -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_input_output(bool v)
+{
+       return v ? "input" : "output";
+}
+#define str_output_input(v)    str_input_output(!(v))
+
 static inline const char *str_on_off(bool v)
 {
        return v ? "on" : "off";