Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thunderbolt: Do not tear down tunnels when driver is unloaded

Now that we have capability to discover existing tunnels during driver
load there is no point tearing down tunnels when the driver gets
unloaded. Instead we can just leave them running. If user disconnects
devices while there is no Thunderbolt driver loaded, tunneled protocol
hotplug happens and is handled by the corresponding driver (pciehp in
case of PCIe tunnel, GFX driver in case of DP tunnel).

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

+6 -18
+4 -6
drivers/thunderbolt/path.c
··· 304 304 } 305 305 306 306 /** 307 - * tb_path_free() - free a deactivated path 307 + * tb_path_free() - free a path 308 + * @path: Path to free 309 + * 310 + * Frees a path. The path does not need to be deactivated. 308 311 */ 309 312 void tb_path_free(struct tb_path *path) 310 313 { 311 314 int i; 312 - 313 - if (path->activated) { 314 - tb_WARN(path->tb, "trying to free an activated path\n") 315 - return; 316 - } 317 315 318 316 for (i = 0; i < path->path_length; i++) { 319 317 const struct tb_path_hop *hop = &path->hops[i];
+1 -3
drivers/thunderbolt/tb.c
··· 500 500 struct tb_tunnel *n; 501 501 502 502 /* tunnels are only present after everything has been initialized */ 503 - list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { 504 - tb_tunnel_deactivate(tunnel); 503 + list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) 505 504 tb_tunnel_free(tunnel); 506 - } 507 505 tb_switch_remove(tb->root_switch); 508 506 tcm->hotplug_active = false; /* signal tb_handle_hotplug to quit */ 509 507 }
+1 -9
drivers/thunderbolt/tunnel.c
··· 475 475 * tb_tunnel_free() - free a tunnel 476 476 * @tunnel: Tunnel to be freed 477 477 * 478 - * The tunnel must have been deactivated. 478 + * Frees a tunnel. The tunnel does not need to be deactivated. 479 479 */ 480 480 void tb_tunnel_free(struct tb_tunnel *tunnel) 481 481 { ··· 483 483 484 484 if (!tunnel) 485 485 return; 486 - 487 - for (i = 0; i < tunnel->npaths; i++) { 488 - if (tunnel->paths[i] && tunnel->paths[i]->activated) { 489 - tb_tunnel_WARN(tunnel, 490 - "trying to free an activated tunnel\n"); 491 - return; 492 - } 493 - } 494 486 495 487 for (i = 0; i < tunnel->npaths; i++) { 496 488 if (tunnel->paths[i])