thunderbolt: Introduce tb_switch_depth()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

[ Upstream commit c4ff14436952c3d0dd05769d76cf48e73a253b48 ]

This is useful helper to find out the depth of a connected router.
Convert the existing users to call this helper instead of open-coding.

No functional changes.

Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
Signed-off-by: Qin Wan <qin.wan@xxxxxx>
Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/thunderbolt/tb.c |    4 ++--
 drivers/thunderbolt/tb.h |    9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -255,13 +255,13 @@ static int tb_enable_clx(struct tb_switc
 	 * this in the future to cover the whole topology if it turns
 	 * out to be beneficial.
 	 */
-	while (sw && sw->config.depth > 1)
+	while (sw && tb_switch_depth(sw) > 1)
 		sw = tb_switch_parent(sw);
 
 	if (!sw)
 		return 0;
 
-	if (sw->config.depth != 1)
+	if (tb_switch_depth(sw) != 1)
 		return 0;
 
 	/*
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -868,6 +868,15 @@ static inline struct tb_port *tb_switch_
 	return tb_port_at(tb_route(sw), tb_switch_parent(sw));
 }
 
+/**
+ * tb_switch_depth() - Returns depth of the connected router
+ * @sw: Router
+ */
+static inline int tb_switch_depth(const struct tb_switch *sw)
+{
+	return sw->config.depth;
+}
+
 static inline bool tb_switch_is_light_ridge(const struct tb_switch *sw)
 {
 	return sw->config.vendor_id == PCI_VENDOR_ID_INTEL &&


Patches currently in stable-queue which might be from alexandru.gagniuc@xxxxxx are

queue-6.6/thunderbolt-introduce-tb_switch_depth.patch
queue-6.6/thunderbolt-fix-debug-log-when-displayport-adapter-not-available-for-pairing.patch
queue-6.6/thunderbolt-change-bandwidth-reservations-to-comply-usb4-v2.patch
queue-6.6/thunderbolt-configure-asymmetric-link-if-needed-and-bandwidth-allows.patch
queue-6.6/thunderbolt-make-is_gen4_link-available-to-the-rest-of-the-driver.patch
queue-6.6/thunderbolt-add-support-for-asymmetric-link.patch
queue-6.6/thunderbolt-introduce-tb_for_each_upstream_port_on_path.patch
queue-6.6/thunderbolt-improve-displayport-tunnel-setup-process-to-be-more-robust.patch
queue-6.6/thunderbolt-expose-tb_tunnel_xxx-log-macros-to-the-rest-of-the-driver.patch
queue-6.6/thunderbolt-use-constants-for-path-weight-and-priority.patch
queue-6.6/thunderbolt-introduce-tb_port_path_direction_downstream.patch
queue-6.6/thunderbolt-use-weight-constants-in-tb_usb3_consumed_bandwidth.patch
queue-6.6/thunderbolt-create-multiple-displayport-tunnels-if-there-are-more-dp-in-out-pairs.patch
queue-6.6/thunderbolt-use-tb_tunnel_dbg-where-possible-to-make-logging-more-consistent.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux