mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib/string_choices: Add str_assert_deassert() helper
@ 2025-09-23  9:52 Prabhakar
  2025-09-28 19:33 ` Andy Shevchenko
  2025-09-29  3:48 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Prabhakar @ 2025-09-23  9:52 UTC (permalink / raw)
  To: Kees Cook, Andy Shevchenko, Philipp Zabel, Geert Uytterhoeven
  Cc: linux-hardening, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add str_assert_deassert() helper to return "assert" or "deassert"
string literal depending on the boolean argument. Also add the
inversed variant str_deassert_assert().

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
Hi All,
Note checkpatch complians about adding a new line before the macro
definition. But this is the existing style in this file. So keeping
it as is.
Cheers, Prabhakar
---
 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 a27c87c954ae..ee84087d4b26 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -17,6 +17,12 @@
 
 #include <linux/types.h>
 
+static inline const char *str_assert_deassert(bool v)
+{
+	return v ? "assert" : "deassert";
+}
+#define str_deassert_assert(v)		str_assert_deassert(!(v))
+
 static inline const char *str_enable_disable(bool v)
 {
 	return v ? "enable" : "disable";
-- 
2.51.0


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

end of thread, other threads:[~2025-09-29  3:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-23  9:52 [PATCH] lib/string_choices: Add str_assert_deassert() helper Prabhakar
2025-09-28 19:33 ` Andy Shevchenko
2025-09-29  3:48 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®