diff mbox series

[01/10] lib/string_choices: Add str_tx_rx() helper

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

Commit Message

Kuninori Morimoto Feb. 26, 2025, 5:35 a.m. UTC
Add str_tx_rx() helper to return "tx" or "rx" 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 120ca0f28e95..fbbf1e657806 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -71,6 +71,12 @@  static inline const char *str_true_false(bool v)
 }
 #define str_false_true(v)		str_true_false(!(v))
 
+static inline const char *str_tx_rx(bool v)
+{
+	return v ? "tx" : "rx";
+}
+#define str_rx_tx(v)		str_tx_rx(!(v))
+
 /**
  * str_plural - Return the simple pluralization based on English counts
  * @num: Number used for deciding pluralization