diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2017-10-11 10:19:54 -0400 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2019-04-18 04:18:53 -0400 |
commit | 344e06430a72347b554a7fd98f3a961084f37be6 (patch) | |
tree | 749030b9462451e58673e0ceb987be245d26c978 | |
parent | 99cabbb006f1eb509e8bbc88c020c806017ed582 (diff) |
thunderbolt: Scan only valid NULL adapter ports in hotplug
The only way to expand Thunderbolt topology is through the NULL adapter
ports (typically ports 1, 2, 3 and 4). There is no point handling
Thunderbolt hotplug events on any other port.
Add a helper function (tb_port_is_null()) that can be used to determine
if the port is NULL port, and use it in software connection manager code
when hotplug event is handled.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r-- | drivers/thunderbolt/tb.c | 10 | ||||
-rw-r--r-- | drivers/thunderbolt/tb.h | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index cfc451c938fd..fb01396a62a9 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c | |||
@@ -356,10 +356,12 @@ static void tb_handle_hotplug(struct work_struct *work) | |||
356 | tb_port_info(port, | 356 | tb_port_info(port, |
357 | "got plug event for connected port, ignoring\n"); | 357 | "got plug event for connected port, ignoring\n"); |
358 | } else { | 358 | } else { |
359 | tb_port_info(port, "hotplug: scanning\n"); | 359 | if (tb_port_is_null(port)) { |
360 | tb_scan_port(port); | 360 | tb_port_info(port, "hotplug: scanning\n"); |
361 | if (!port->remote) | 361 | tb_scan_port(port); |
362 | tb_port_info(port, "hotplug: no switch found\n"); | 362 | if (!port->remote) |
363 | tb_port_info(port, "hotplug: no switch found\n"); | ||
364 | } | ||
363 | } | 365 | } |
364 | 366 | ||
365 | put_sw: | 367 | put_sw: |
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index 5b5ba8919086..260360ec59a9 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h | |||
@@ -350,6 +350,11 @@ static inline bool tb_port_has_remote(const struct tb_port *port) | |||
350 | return true; | 350 | return true; |
351 | } | 351 | } |
352 | 352 | ||
353 | static inline bool tb_port_is_null(const struct tb_port *port) | ||
354 | { | ||
355 | return port && port->port && port->config.type == TB_TYPE_PORT; | ||
356 | } | ||
357 | |||
353 | static inline bool tb_port_is_pcie_down(const struct tb_port *port) | 358 | static inline bool tb_port_is_pcie_down(const struct tb_port *port) |
354 | { | 359 | { |
355 | return port && port->config.type == TB_TYPE_PCIE_DOWN; | 360 | return port && port->config.type == TB_TYPE_PCIE_DOWN; |