public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Sanjay R Mehta <Sanju.Mehta@amd.com>
To: <mika.westerberg@linux.intel.com>, <andreas.noever@gmail.com>,
	<michael.jamet@intel.com>, <YehezkelShB@gmail.com>
Cc: <Basavaraj.Natikar@amd.com>, <jagadish.hadimani@amd.com>,
	<sachinkumar.butte@amd.com>, <linux-usb@vger.kernel.org>,
	Sanjay R Mehta <sanju.mehta@amd.com>
Subject: [PATCH] thunderbolt: Retain host router DP IN resources during suspend
Date: Fri, 18 Feb 2022 01:11:25 -0600	[thread overview]
Message-ID: <1645168285-126273-1-git-send-email-Sanju.Mehta@amd.com> (raw)

From: Sanjay R Mehta <sanju.mehta@amd.com>

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@amd.com>
Suggested-by: Sachinkumar Butte <sachinkumar.butte@amd.com>
Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 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


             reply	other threads:[~2022-02-18  7:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  7:11 Sanjay R Mehta [this message]
2022-02-18 11:13 ` [PATCH] thunderbolt: Retain host router DP IN resources during suspend Mika Westerberg
2022-02-18 14:08   ` Sanjay R Mehta
2022-02-18 14:25     ` Mika Westerberg
2022-02-20 11:57       ` Sanjay R Mehta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1645168285-126273-1-git-send-email-Sanju.Mehta@amd.com \
    --to=sanju.mehta@amd.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=jagadish.hadimani@amd.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=michael.jamet@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=sachinkumar.butte@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox