thunderbolt: Make usb4_switch_map_usb3_down() also return enabled ports
authorMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 11 Mar 2020 13:00:46 +0000 (16:00 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 22 Jun 2020 16:58:20 +0000 (19:58 +0300)
We need to call this on enabled ports in order to find the mapping from
host router USB4 port to a USB 3.x downstream adapter, so make the
function return enabled ports as well.

While there fix parameter alignment in tb_find_usb3_down().

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb.c
drivers/thunderbolt/usb4.c

index 2da82259e77c830b054703aac34d02c56acb7fe1..82f62a023a4b552173f91a418560c0d42e77ebb2 100644 (file)
@@ -206,22 +206,14 @@ static struct tb_port *tb_find_unused_port(struct tb_switch *sw,
 }
 
 static struct tb_port *tb_find_usb3_down(struct tb_switch *sw,
-                                       const struct tb_port *port)
+                                        const struct tb_port *port)
 {
        struct tb_port *down;
 
        down = usb4_switch_map_usb3_down(sw, port);
-       if (down) {
-               if (WARN_ON(!tb_port_is_usb3_down(down)))
-                       goto out;
-               if (WARN_ON(tb_usb3_port_is_enabled(down)))
-                       goto out;
-
+       if (down && !tb_usb3_port_is_enabled(down))
                return down;
-       }
-
-out:
-       return tb_find_unused_port(sw, TB_TYPE_USB3_DOWN);
+       return NULL;
 }
 
 static int tb_tunnel_usb3(struct tb *tb, struct tb_switch *sw)
index 393771d50962c47ea43c64618bbe28e0259aa738..375a8c459201239ff47f5f64573166a2b3a798c0 100644 (file)
@@ -759,7 +759,7 @@ struct tb_port *usb4_switch_map_usb3_down(struct tb_switch *sw,
                if (!tb_port_is_usb3_down(p))
                        continue;
 
-               if (usb_idx == usb4_idx && !tb_usb3_port_is_enabled(p))
+               if (usb_idx == usb4_idx)
                        return p;
 
                usb_idx++;