Add str_plural() helper to replace existing open implementations used by many drivers and help improve future user facing messages.
Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Jani Nikula <[email protected]> --- include/linux/string_choices.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index 3c1091941eb8..f3cd270d11fd 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -42,4 +42,9 @@ static inline const char *str_yes_no(bool v) return v ? "yes" : "no"; } +static inline const char *str_plural(size_t num) +{ + return num == 1 ? "" : "s"; +} + #endif -- 2.43.0
