Add str_tx_rx() helper to return "tx" or "rx" string literal.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto...@renesas.com>
---
 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 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
-- 
2.43.0


Reply via email to