* [PATCH] drivers: thunderbolt: Use string choices helpers
@ 2025-08-24 15:13 Chelsy Ratnawat
2025-08-26 6:07 ` Mika Westerberg
0 siblings, 1 reply; 2+ messages in thread
From: Chelsy Ratnawat @ 2025-08-24 15:13 UTC (permalink / raw)
To: andreas.noever, westeri, michael.jamet, YehezkelShB
Cc: linux-usb, Chelsy Ratnawat
Use string_choices.h helpers instead of hard-coded strings.
Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
---
drivers/thunderbolt/debugfs.c | 3 ++-
drivers/thunderbolt/nhi.c | 3 ++-
drivers/thunderbolt/usb4.c | 13 +++++++------
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
index f8328ca7e22e..628337ac880e 100644
--- a/drivers/thunderbolt/debugfs.c
+++ b/drivers/thunderbolt/debugfs.c
@@ -13,6 +13,7 @@
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/uaccess.h>
+#include <linux/string_choices.h>
#include "tb.h"
#include "sb_regs.h"
@@ -691,7 +692,7 @@ static int margining_caps_show(struct seq_file *s, void *not_used)
seq_printf(s, "0x%08x\n", margining->caps[i]);
seq_printf(s, "# software margining: %s\n",
- supports_software(margining) ? "yes" : "no");
+ str_yes_no(supports_software(margining)));
if (supports_hardware(margining)) {
seq_puts(s, "# hardware margining: yes\n");
seq_puts(s, "# minimum BER level contour: ");
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index f3a2264e012b..679c51440174 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -20,6 +20,7 @@
#include <linux/delay.h>
#include <linux/property.h>
#include <linux/string_helpers.h>
+#include <linux/string_choices.h>
#include "nhi.h"
#include "nhi_regs.h"
@@ -146,7 +147,7 @@ static void ring_interrupt_active(struct tb_ring *ring, bool active)
dev_WARN(&ring->nhi->pdev->dev,
"interrupt for %s %d is already %s\n",
RING_TYPE(ring), ring->hop,
- active ? "enabled" : "disabled");
+ str_enabled_disabled(active));
if (active)
iowrite32(new, ring->nhi->iobase + reg);
diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c
index fdae76c8f728..4729b45aac1f 100644
--- a/drivers/thunderbolt/usb4.c
+++ b/drivers/thunderbolt/usb4.c
@@ -10,6 +10,7 @@
#include <linux/delay.h>
#include <linux/ktime.h>
#include <linux/units.h>
+#include <linux/string_choices.h>
#include "sb_regs.h"
#include "tb.h"
@@ -172,8 +173,8 @@ void usb4_switch_check_wakes(struct tb_switch *sw)
return;
tb_sw_dbg(sw, "PCIe wake: %s, USB3 wake: %s\n",
- (val & ROUTER_CS_6_WOPS) ? "yes" : "no",
- (val & ROUTER_CS_6_WOUS) ? "yes" : "no");
+ str_yes_no(val & ROUTER_CS_6_WOPS),
+ str_yes_no(val & ROUTER_CS_6_WOUS));
wakeup = val & (ROUTER_CS_6_WOPS | ROUTER_CS_6_WOUS);
}
@@ -191,9 +192,9 @@ void usb4_switch_check_wakes(struct tb_switch *sw)
break;
tb_port_dbg(port, "USB4 wake: %s, connection wake: %s, disconnection wake: %s\n",
- (val & PORT_CS_18_WOU4S) ? "yes" : "no",
- (val & PORT_CS_18_WOCS) ? "yes" : "no",
- (val & PORT_CS_18_WODS) ? "yes" : "no");
+ str_yes_no(val & PORT_CS_18_WOU4S),
+ str_yes_no(val & PORT_CS_18_WOCS),
+ str_yes_no(val & PORT_CS_18_WODS));
wakeup_usb4 = val & (PORT_CS_18_WOU4S | PORT_CS_18_WOCS |
PORT_CS_18_WODS);
@@ -260,7 +261,7 @@ int usb4_switch_setup(struct tb_switch *sw)
tbt3 = !(val & ROUTER_CS_6_TNS);
tb_sw_dbg(sw, "TBT3 support: %s, xHCI: %s\n",
- tbt3 ? "yes" : "no", xhci ? "yes" : "no");
+ str_yes_no(tbt3), str_yes_no(xhci));
ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1);
if (ret)
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: thunderbolt: Use string choices helpers
2025-08-24 15:13 [PATCH] drivers: thunderbolt: Use string choices helpers Chelsy Ratnawat
@ 2025-08-26 6:07 ` Mika Westerberg
0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2025-08-26 6:07 UTC (permalink / raw)
To: Chelsy Ratnawat
Cc: andreas.noever, westeri, michael.jamet, YehezkelShB, linux-usb
On Sun, Aug 24, 2025 at 08:13:16AM -0700, Chelsy Ratnawat wrote:
> Use string_choices.h helpers instead of hard-coded strings.
>
> Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Applied to thunderbolt.git/next, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-26 6:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-24 15:13 [PATCH] drivers: thunderbolt: Use string choices helpers Chelsy Ratnawat
2025-08-26 6:07 ` Mika Westerberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).