From: Lad Prabhakar <[email protected]> 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 <[email protected]> Signed-off-by: Lad Prabhakar <[email protected]> --- Hi All, Note checkpatch complians about adding a new line before the macro definition. But this is the existing style in this file. So keeping it as is. Cheers, Prabhakar --- include/linux/string_choices.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index a27c87c954ae..ee84087d4b26 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -17,6 +17,12 @@ #include <linux/types.h> +static inline const char *str_assert_deassert(bool v) +{ + return v ? "assert" : "deassert"; +} +#define str_deassert_assert(v) str_assert_deassert(!(v)) + static inline const char *str_enable_disable(bool v) { return v ? "enable" : "disable"; -- 2.51.0
