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

* Re: [PATCH] lib/string_choices: Add str_assert_deassert() helper
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-09-28 19:33 UTC (permalink / raw)
  To: Prabhakar
  Cc: Kees Cook, Andy Shevchenko, Philipp Zabel, Geert Uytterhoeven,
	linux-hardening, linux-kernel, linux-renesas-soc, Biju Das,
	Fabrizio Castro, Lad Prabhakar

On Tue, Sep 23, 2025 at 12:52 PM Prabhakar <prabhakar.csengg@gmail.com> wrote:
>
> 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().

FWIW,
Reviewed-by: Andy Shevchenko <andy@kernel.org>

...

> 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.

It's a checkpatch's problem. It's fine to ignore it in this case.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] lib/string_choices: Add str_assert_deassert() helper
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2025-09-29  3:48 UTC (permalink / raw)
  To: Andy Shevchenko, Philipp Zabel, Geert Uytterhoeven, Prabhakar
  Cc: Kees Cook, linux-hardening, linux-kernel, linux-renesas-soc,
	Biju Das, Fabrizio Castro, Lad Prabhakar

On Tue, 23 Sep 2025 10:52:29 +0100, Prabhakar wrote:
> 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().
> 
> 

Applied to for-next/hardening, thanks!

[1/1] lib/string_choices: Add str_assert_deassert() helper
      https://git.kernel.org/kees/c/c8a935a31bc7

Take care,

-- 
Kees Cook


^ 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®