Add str_alloc_free() helper to return "alloc" or "free" string literal depending on the boolean argument. Also add the inversed variant str_free_alloc(). Tested-by: mingzhu.wang Signed-off-by: Jiazi Li --- 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 ee84087d4b26..65f346db95ba 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -17,6 +17,12 @@ #include +static inline const char *str_alloc_free(bool v) +{ + return v ? "alloc" : "free"; +} +#define str_free_alloc(v) str_alloc_free(!(v)) + static inline const char *str_assert_deassert(bool v) { return v ? "assert" : "deassert"; -- 2.49.0