[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250923095229.2149740-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
Date: Tue, 23 Sep 2025 10:52:29 +0100
From: Prabhakar <prabhakar.csengg@...il.com>
To: Kees Cook <kees@...nel.org>,
Andy Shevchenko <andy@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Geert Uytterhoeven <geert+renesas@...der.be>
Cc: linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
Prabhakar <prabhakar.csengg@...il.com>,
Biju Das <biju.das.jz@...renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: [PATCH] lib/string_choices: Add str_assert_deassert() helper
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...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@...gutronix.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...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
Powered by blists - more mailing lists