]> www.infradead.org Git - users/hch/misc.git/commitdiff
thunderbolt: Use string choices helpers
authorChelsy Ratnawat <chelsyratnawat2001@gmail.com>
Sun, 24 Aug 2025 15:13:16 +0000 (08:13 -0700)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 26 Aug 2025 05:59:41 +0000 (07:59 +0200)
Use string_choices.h helpers instead of hard-coded strings.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/debugfs.c
drivers/thunderbolt/nhi.c
drivers/thunderbolt/usb4.c

index f8328ca7e22e59d01b02f79d5f3b869f44cfe758..46a2a3550be71ea64ce71a066c395b7ef3def9c8 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/pm_runtime.h>
+#include <linux/string_choices.h>
 #include <linux/uaccess.h>
 
 #include "tb.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: ");
index f3a2264e012bcdd2739331fc5770c0760cd0fdd7..8a38b05d25c5335584c13c47af175b48dbe3af57 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/property.h>
+#include <linux/string_choices.h>
 #include <linux/string_helpers.h>
 
 #include "nhi.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);
index fdae76c8f728e1e8744d8af44723ab8e4c3878d9..e160afadd50108ca21a65f45df4a2a14bce51fc0 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/delay.h>
 #include <linux/ktime.h>
+#include <linux/string_choices.h>
 #include <linux/units.h>
 
 #include "sb_regs.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)