Add str_locked_unlocked()/str_unlocked_locked() helper to return "locked" or "unlocked" string literal
Suggested-by: Przemek Kitszel <[email protected]> Signed-off-by: R Sundar <[email protected]> --- https://lore.kernel.org/all/[email protected]/ https://lore.kernel.org/all/[email protected]/ There are about 9 occurence for locked and unlocked string combination. 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 120ca0f28e95..c3ad47e1051b 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num) return num == 1 ? "" : "s"; } +static inline const char *str_locked_unlocked(bool v) +{ + return v ? "locked" : "unlocked"; +} +#define str_unlocked_locked(v) str_locked_unlocked(!(v)) + #endif -- 2.34.1
