[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240214165015.1656-1-michal.wajdeczko@intel.com>
Date: Wed, 14 Feb 2024 17:50:15 +0100
From: Michal Wajdeczko <michal.wajdeczko@...el.com>
To: linux-hardening@...r.kernel.org
Cc: Michal Wajdeczko <michal.wajdeczko@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Jani Nikula <jani.nikula@...el.com>
Subject: [PATCH] lib/string_choices: Add str_plural() helper
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 <michal.wajdeczko@...el.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Jani Nikula <jani.nikula@...el.com>
---
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
Powered by blists - more mailing lists