diff options
author | Gil Fine <gil.fine@intel.com> | 2022-09-23 01:30:38 +0300 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2023-06-09 12:07:22 +0300 |
commit | 7ce542219b6323764cb922722b677005404d9b60 (patch) | |
tree | 13d0ddb08544c5a34a01cc0ba874756529938a5f /drivers/thunderbolt/tb.h | |
parent | ef65afa0740e28cb0951fa9012cb78765f883a4a (diff) | |
download | linux-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/tb.h')
-rw-r--r-- | drivers/thunderbolt/tb.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index 275ff5219a3a..a8e1725b4cb5 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -857,6 +857,20 @@ static inline struct tb_switch *tb_switch_parent(struct tb_switch *sw) return tb_to_switch(sw->dev.parent); } +/** + * tb_switch_downstream_port() - Return downstream facing port of parent router + * @sw: Device router pointer + * + * Only call for device routers. Returns the downstream facing port of + * the parent router. + */ +static inline struct tb_port *tb_switch_downstream_port(struct tb_switch *sw) +{ + if (WARN_ON(!tb_route(sw))) + return NULL; + return tb_port_at(tb_route(sw), tb_switch_parent(sw)); +} + static inline bool tb_switch_is_light_ridge(const struct tb_switch *sw) { return sw->config.vendor_id == PCI_VENDOR_ID_INTEL && |