thunderbolt: Deactivate all paths before restarting them
authorMika Westerberg <mika.westerberg@linux.intel.com>
Sun, 19 Feb 2017 21:37:35 +0000 (23:37 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 18 Apr 2019 08:18:52 +0000 (11:18 +0300)
State of the connected devices and tunnel configuration is not known
during resume. For example some paths may not be complete anymore if the
user has unplugged the related devices. So instead of marking all paths
as inactive we go ahead and deactivate them explicitly before we restart
them.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tunnel.c

index 91d7e00516b488faa3867f9313836821d0c0cca5..e109578da175f19cb3a3dd1c609a2e3b48572e06 100644 (file)
@@ -185,8 +185,18 @@ int tb_tunnel_restart(struct tb_tunnel *tunnel)
 
        tb_tunnel_info(tunnel, "activating\n");
 
+       /*
+        * Make sure all paths are properly disabled before enabling
+        * them again.
+        */
+       for (i = 0; i < tunnel->npaths; i++) {
+               if (tunnel->paths[i]->activated) {
+                       tb_path_deactivate(tunnel->paths[i]);
+                       tunnel->paths[i]->activated = false;
+               }
+       }
+
        for (i = 0; i < tunnel->npaths; i++) {
-               tunnel->paths[i]->activated = false;
                res = tb_path_activate(tunnel->paths[i]);
                if (res)
                        goto err;