All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] lib/string_choices: add few more convenient choice helpers
@ 2026-08-20  6:11 Dmitry Antipov
  2026-08-20  6:11 ` [PATCH 2/6] coccinelle: add rules to match recently introduced " Dmitry Antipov
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Dmitry Antipov @ 2026-08-20  6:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
	Richard Fitzgerald, Tony Nguyen, Przemek Kitszel, Adrian Hunter,
	Ulf Hansson, Edward Cree, linux-kernel, Dmitry Antipov

Looking over a few kernel subsystems I'm currently working
on, I suppose that 'str_pass_fail()', 'str_passed_failed()',
'str_lock_unlock()' and 'str_locked_unlocked()' with their
opposite counterpart macros may be useful as well.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 include/linux/string_choices.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index ee84087d4b26..8cdfc24dd4e1 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -53,12 +53,36 @@ static inline const char *str_input_output(bool v)
 }
 #define str_output_input(v)	str_input_output(!(v))
 
+static inline const char *str_lock_unlock(bool v)
+{
+	return v ? "lock" : "unlock";
+}
+#define str_unlock_lock(v)		str_lock_unlock(!(v))
+
+static inline const char *str_locked_unlocked(bool v)
+{
+	return v ? "locked" : "unlocked";
+}
+#define str_unlocked_locked(v)		str_locked_unlocked(!(v))
+
 static inline const char *str_on_off(bool v)
 {
 	return v ? "on" : "off";
 }
 #define str_off_on(v)		str_on_off(!(v))
 
+static inline const char *str_pass_fail(bool v)
+{
+	return v ? "pass" : "fail";
+}
+#define str_fail_pass(v)		str_pass_fail(!(v))
+
+static inline const char *str_passed_failed(bool v)
+{
+	return v ? "passed" : "failed";
+}
+#define str_failed_passed(v)		str_passed_failed(!(v))
+
 static inline const char *str_read_write(bool v)
 {
 	return v ? "read" : "write";
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-08-20  9:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
2026-08-20  6:11 ` [PATCH 2/6] coccinelle: add rules to match recently introduced " Dmitry Antipov
2026-08-20  6:11 ` [PATCH 3/6] ASoC: cs48l32: use str_lock_unlock() helper Dmitry Antipov
2026-08-20  6:39   ` Andy Shevchenko
2026-08-20  6:11 ` [PATCH 4/6] ice: use string choice helpers Dmitry Antipov
2026-08-20  6:43   ` Andy Shevchenko
2026-08-20  9:30   ` Przemek Kitszel
2026-08-20  6:11 ` [PATCH 5/6] mmc: sdhci-of-k1: use str_fail_pass() helper Dmitry Antipov
2026-08-20  6:44   ` Andy Shevchenko
2026-08-20  6:11 ` [PATCH 6/6] net: sfc: use string choice helpers Dmitry Antipov
2026-08-20  6:47   ` Andy Shevchenko
2026-08-20  6:39 ` [PATCH 1/6] lib/string_choices: add few more convenient " Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.