[PATCH] thunderbolt: Retain host router DP IN resources during suspend

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

 



From: Sanjay R Mehta <sanju.mehta@xxxxxxx>

All DP resources are released during suspend and while
resuming back DP IN resource is not available, therefore
unable to find DP pair to re-establish the DP tunnel.

Hence preserve host routers DP IN resources and
release all other DP resources during suspend.

Suggested-by: Jagadish Hadimani <jagadish.hadimani@xxxxxxx>
Suggested-by: Sachinkumar Butte <sachinkumar.butte@xxxxxxx>
Signed-off-by: Sanjay R Mehta <sanju.mehta@xxxxxxx>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@xxxxxxx>
---
 drivers/thunderbolt/tb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index cbd0ad8..a11710e 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -1022,6 +1022,7 @@ static void tb_disconnect_and_release_dp(struct tb *tb)
 {
 	struct tb_cm *tcm = tb_priv(tb);
 	struct tb_tunnel *tunnel, *n;
+	struct tb_port *port, *tmp;
 
 	/*
 	 * Tear down all DP tunnels and release their resources. They
@@ -1032,11 +1033,10 @@ static void tb_disconnect_and_release_dp(struct tb *tb)
 			tb_deactivate_and_free_tunnel(tunnel);
 	}
 
-	while (!list_empty(&tcm->dp_resources)) {
-		struct tb_port *port;
-
-		port = list_first_entry(&tcm->dp_resources,
-					struct tb_port, list);
+	list_for_each_entry_safe(port, tmp, &tcm->dp_resources, list) {
+		/* Preserve root switch DP IN resource */
+		if (!tb_route(port->sw) && tb_port_is_dpin(port))
+			continue;
 		list_del_init(&port->list);
 	}
 }
-- 
2.7.4




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux