thunderbolt: Move width_name() helper to tb.h
authorGil Fine <gil.fine@linux.intel.com>
Sun, 5 Nov 2023 15:52:19 +0000 (17:52 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 14 Dec 2023 06:07:44 +0000 (08:07 +0200)
We are going to use it in subsequent patches, so make it available outside of
switch.c. Also, change the name to tb_width_name() to follow the naming
conventions.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/switch.c
drivers/thunderbolt/tb.h

index 1e15ffa792955d7382b19546226bdcfa603a5685..7873b173a351798544b5eb5f3ac6b6cfbb41eb2a 100644 (file)
@@ -941,22 +941,6 @@ int tb_port_get_link_generation(struct tb_port *port)
        }
 }
 
-static const char *width_name(enum tb_link_width width)
-{
-       switch (width) {
-       case TB_LINK_WIDTH_SINGLE:
-               return "symmetric, single lane";
-       case TB_LINK_WIDTH_DUAL:
-               return "symmetric, dual lanes";
-       case TB_LINK_WIDTH_ASYM_TX:
-               return "asymmetric, 3 transmitters, 1 receiver";
-       case TB_LINK_WIDTH_ASYM_RX:
-               return "asymmetric, 3 receivers, 1 transmitter";
-       default:
-               return "unknown";
-       }
-}
-
 /**
  * tb_port_get_link_width() - Get current link width
  * @port: Port to check (USB4 or CIO)
@@ -2769,7 +2753,7 @@ static void tb_switch_link_init(struct tb_switch *sw)
                return;
 
        tb_sw_dbg(sw, "current link speed %u.0 Gb/s\n", sw->link_speed);
-       tb_sw_dbg(sw, "current link width %s\n", width_name(sw->link_width));
+       tb_sw_dbg(sw, "current link width %s\n", tb_width_name(sw->link_width));
 
        bonded = sw->link_width >= TB_LINK_WIDTH_DUAL;
 
@@ -3029,7 +3013,7 @@ int tb_switch_set_link_width(struct tb_switch *sw, enum tb_link_width width)
 
        tb_switch_update_link_attributes(sw);
 
-       tb_sw_dbg(sw, "link width set to %s\n", width_name(width));
+       tb_sw_dbg(sw, "link width set to %s\n", tb_width_name(width));
        return ret;
 }
 
index e299e53473ae28627216dacf3d9dbdfcf2ec8239..1760c21e5b12fe5165a0f599a09fd9121123e92c 100644 (file)
@@ -568,6 +568,22 @@ static inline struct tb_port *tb_port_at(u64 route, struct tb_switch *sw)
        return &sw->ports[port];
 }
 
+static inline const char *tb_width_name(enum tb_link_width width)
+{
+       switch (width) {
+       case TB_LINK_WIDTH_SINGLE:
+               return "symmetric, single lane";
+       case TB_LINK_WIDTH_DUAL:
+               return "symmetric, dual lanes";
+       case TB_LINK_WIDTH_ASYM_TX:
+               return "asymmetric, 3 transmitters, 1 receiver";
+       case TB_LINK_WIDTH_ASYM_RX:
+               return "asymmetric, 3 receivers, 1 transmitter";
+       default:
+               return "unknown";
+       }
+}
+
 /**
  * tb_port_has_remote() - Does the port have switch connected downstream
  * @port: Port to check