summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/acpi.c
diff options
context:
space:
mode:
authorGil Fine <gil.fine@intel.com>2022-09-23 01:30:38 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-06-09 12:07:22 +0300
commit7ce542219b6323764cb922722b677005404d9b60 (patch)
tree13d0ddb08544c5a34a01cc0ba874756529938a5f /drivers/thunderbolt/acpi.c
parentef65afa0740e28cb0951fa9012cb78765f883a4a (diff)
downloadlinux-7ce542219b6323764cb922722b677005404d9b60.tar.xz
thunderbolt: Introduce tb_switch_downstream_port()
Introduce tb_switch_downstream_port() helper function that returns the downstream port of a parent switch that is connected to the upstream port of specified switch. From now on, we use it all across the driver where applicable. While there fix a whitespace in comment and rename 'downstream' to 'down' to be consistent with the rest of the driver. Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/acpi.c')
-rw-r--r--drivers/thunderbolt/acpi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
index 3514bf65b7a4..38fefd0e5268 100644
--- a/drivers/thunderbolt/acpi.c
+++ b/drivers/thunderbolt/acpi.c
@@ -296,16 +296,15 @@ static bool tb_acpi_bus_match(struct device *dev)
static struct acpi_device *tb_acpi_switch_find_companion(struct tb_switch *sw)
{
+ struct tb_switch *parent_sw = tb_switch_parent(sw);
struct acpi_device *adev = NULL;
- struct tb_switch *parent_sw;
/*
* Device routers exists under the downstream facing USB4 port
* of the parent router. Their _ADR is always 0.
*/
- parent_sw = tb_switch_parent(sw);
if (parent_sw) {
- struct tb_port *port = tb_port_at(tb_route(sw), parent_sw);
+ struct tb_port *port = tb_switch_downstream_port(sw);
struct acpi_device *port_adev;
port_adev = acpi_find_child_by_adr(ACPI_COMPANION(&parent_sw->dev),