diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2017-02-19 14:48:29 +0300 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2019-04-18 11:18:52 +0300 |
commit | 93f36ade5b7b82a842a3d6284b8cdb68adb93e85 (patch) | |
tree | 0fcffda4eaaa3d528fa72f8c37a8e3a9656d83e7 /drivers/thunderbolt/tb.c | |
parent | 1752b9f78713c7a188495319ebafbe7868718962 (diff) | |
download | linux-93f36ade5b7b82a842a3d6284b8cdb68adb93e85.tar.xz |
thunderbolt: Generalize tunnel creation functionality
To be able to tunnel non-PCIe traffic, separate tunnel functionality
into generic and PCIe specific parts. Rename struct tb_pci_tunnel to
tb_tunnel, and make it hold an array of paths instead of just two.
Update all the tunneling functions to take this structure as parameter.
We also move tb_pci_port_active() to switch.c (and rename it) where we
will be keeping all port and switch related functions.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-rw-r--r-- | drivers/thunderbolt/tb.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 8de43a2ab205..36dad0a00ac2 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -91,14 +91,14 @@ static void tb_scan_port(struct tb_port *port) static void tb_free_invalid_tunnels(struct tb *tb) { struct tb_cm *tcm = tb_priv(tb); - struct tb_pci_tunnel *tunnel; - struct tb_pci_tunnel *n; + struct tb_tunnel *tunnel; + struct tb_tunnel *n; list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { - if (tb_pci_is_invalid(tunnel)) { - tb_pci_deactivate(tunnel); + if (tb_tunnel_is_invalid(tunnel)) { + tb_tunnel_deactivate(tunnel); list_del(&tunnel->list); - tb_pci_free(tunnel); + tb_tunnel_free(tunnel); } } } @@ -178,7 +178,7 @@ static void tb_activate_pcie_devices(struct tb *tb) struct tb_switch *sw; struct tb_port *up_port; struct tb_port *down_port; - struct tb_pci_tunnel *tunnel; + struct tb_tunnel *tunnel; struct tb_cm *tcm = tb_priv(tb); /* scan for pcie devices at depth 1*/ @@ -214,17 +214,17 @@ static void tb_activate_pcie_devices(struct tb *tb) "All PCIe down ports are occupied, aborting\n"); continue; } - tunnel = tb_pci_alloc(tb, up_port, down_port); + tunnel = tb_tunnel_alloc_pci(tb, up_port, down_port); if (!tunnel) { tb_port_info(up_port, "PCIe tunnel allocation failed, aborting\n"); continue; } - if (tb_pci_activate(tunnel)) { + if (tb_tunnel_activate(tunnel)) { tb_port_info(up_port, "PCIe tunnel activation failed, aborting\n"); - tb_pci_free(tunnel); + tb_tunnel_free(tunnel); continue; } @@ -353,13 +353,13 @@ static void tb_handle_event(struct tb *tb, enum tb_cfg_pkg_type type, static void tb_stop(struct tb *tb) { struct tb_cm *tcm = tb_priv(tb); - struct tb_pci_tunnel *tunnel; - struct tb_pci_tunnel *n; + struct tb_tunnel *tunnel; + struct tb_tunnel *n; /* tunnels are only present after everything has been initialized */ list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { - tb_pci_deactivate(tunnel); - tb_pci_free(tunnel); + tb_tunnel_deactivate(tunnel); + tb_tunnel_free(tunnel); } tb_switch_remove(tb->root_switch); tcm->hotplug_active = false; /* signal tb_handle_hotplug to quit */ @@ -418,7 +418,7 @@ static int tb_suspend_noirq(struct tb *tb) static int tb_resume_noirq(struct tb *tb) { struct tb_cm *tcm = tb_priv(tb); - struct tb_pci_tunnel *tunnel, *n; + struct tb_tunnel *tunnel, *n; tb_dbg(tb, "resuming...\n"); @@ -429,7 +429,7 @@ static int tb_resume_noirq(struct tb *tb) tb_free_invalid_tunnels(tb); tb_free_unplugged_children(tb->root_switch); list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) - tb_pci_restart(tunnel); + tb_tunnel_restart(tunnel); if (!list_empty(&tcm->tunnel_list)) { /* * the pcie links need some time to get going. |