From: Thomas Richard Date: Mon, 11 Aug 2025 13:25:52 +0000 (+0200) Subject: lib/string_choices: Add str_input_output() helper X-Git-Tag: v6.18-rc1~155^2~60^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53ec9169db1345f04174febb90f88a871fc28d9e;p=thirdparty%2Fkernel%2Flinux.git lib/string_choices: Add str_input_output() helper Add str_input_output() helper to return 'input' or 'output' string literal. Also add the inversed variant str_output_input(). Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Acked-by: Linus Walleij Signed-off-by: Thomas Richard Link: https://lore.kernel.org/r/20250811-aaeon-up-board-pinctrl-support-v9-9-29f0cbbdfb30@bootlin.com Signed-off-by: Bartosz Golaszewski --- diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index f3ba4f52ff260..a27c87c954ae0 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_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";