summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/tb.h
diff options
context:
space:
mode:
authorGil Fine <gil.fine@linux.intel.com>2023-08-10 22:37:14 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-10-20 18:18:01 +0300
commit2bfeca73e94567c1a117ca45d2e8a25d63e5bd2c (patch)
tree07815aa037a7e03ad44c022b7dfddc3fb7f6b5ef /drivers/thunderbolt/tb.h
parentce91d793ab8bc55804cdac2536bc33c249e75196 (diff)
downloadlwn-2bfeca73e94567c1a117ca45d2e8a25d63e5bd2c.tar.gz
lwn-2bfeca73e94567c1a117ca45d2e8a25d63e5bd2c.zip
thunderbolt: Introduce tb_port_path_direction_downstream()
Introduce tb_port_path_direction_downstream() to check if path from source adapter to destination adapter is directed towards downstream. Convert existing users to call this helper instead of open-coding. No functional changes. Signed-off-by: Gil Fine <gil.fine@linux.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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 3c9ae5584569..6d49510eea09 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -1041,6 +1041,21 @@ void tb_port_release_out_hopid(struct tb_port *port, int hopid);
struct tb_port *tb_next_port_on_path(struct tb_port *start, struct tb_port *end,
struct tb_port *prev);
+/**
+ * tb_port_path_direction_downstream() - Checks if path directed downstream
+ * @src: Source adapter
+ * @dst: Destination adapter
+ *
+ * Returns %true only if the specified path from source adapter (@src)
+ * to destination adapter (@dst) is directed downstream.
+ */
+static inline bool
+tb_port_path_direction_downstream(const struct tb_port *src,
+ const struct tb_port *dst)
+{
+ return src->sw->config.depth < dst->sw->config.depth;
+}
+
static inline bool tb_port_use_credit_allocation(const struct tb_port *port)
{
return tb_port_is_null(port) && port->sw->credit_allocation;