Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/string_choices: Add str_assert_deassert() helper

Add str_assert_deassert() helper to return "assert" or "deassert"
string literal depending on the boolean argument. Also add the
inversed variant str_deassert_assert().

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250923095229.2149740-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Lad Prabhakar and committed by
Kees Cook
c8a935a3 23ef9d43

+6
+6
include/linux/string_choices.h
··· 17 17 18 18 #include <linux/types.h> 19 19 20 + static inline const char *str_assert_deassert(bool v) 21 + { 22 + return v ? "assert" : "deassert"; 23 + } 24 + #define str_deassert_assert(v) str_assert_deassert(!(v)) 25 + 20 26 static inline const char *str_enable_disable(bool v) 21 27 { 22 28 return v ? "enable" : "disable";