diff mbox series

[09/10] lib/string_choices: Add str_kernel_user() helper

Message ID 87ldtt6zdy.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New
Headers show
Series lib/string_choices: Add new helpers | expand

Commit Message

Kuninori Morimoto Feb. 26, 2025, 5:36 a.m. UTC
Add str_kernel_user() helper to return "kernel" or "user" string literal.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/linux/string_choices.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index 1965d3a5976b..82c5927d50a9 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -119,6 +119,12 @@  static inline const char *str_level_edge(bool v)
 }
 #define str_edge_level(v)	str_level_edge(!(v))
 
+static inline const char *str_kernel_user(bool v)
+{
+	return v ? "kernel" : "user";
+}
+#define str_user_kernel(v)	str_kernel_user(!(v))
+
 /**
  * str_plural - Return the simple pluralization based on English counts
  * @num: Number used for deciding pluralization