All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Lukas Wunner <lukas@wunner.de>,
	Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH 08/12] thunderbolt: Drop tb_tunnel_restart()
Date: Tue, 17 Dec 2024 10:22:18 +0200	[thread overview]
Message-ID: <20241217082222.528602-9-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20241217082222.528602-1-mika.westerberg@linux.intel.com>

It is pretty much the same as tb_tunnel_activate() excepts does check
for already activated paths. This is not needed anymore and makes it
more streamlined so drop tb_tunnel_restart() in favour of
tb_tunnel_activate().

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/tb.c     |  4 ++--
 drivers/thunderbolt/tunnel.c | 27 +++------------------------
 drivers/thunderbolt/tunnel.h |  1 -
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 7595ca00b6b8..53e4890e3198 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -3037,7 +3037,7 @@ static int tb_resume_noirq(struct tb *tb)
 			/* Only need to do it once */
 			usb3_delay = 0;
 		}
-		tb_tunnel_restart(tunnel);
+		tb_tunnel_activate(tunnel);
 	}
 	if (!list_empty(&tcm->tunnel_list)) {
 		/*
@@ -3147,7 +3147,7 @@ static int tb_runtime_resume(struct tb *tb)
 	tb_free_invalid_tunnels(tb);
 	tb_restore_children(tb->root_switch);
 	list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list)
-		tb_tunnel_restart(tunnel);
+		tb_tunnel_activate(tunnel);
 	tb_switch_enter_redrive(tb->root_switch);
 	tcm->hotplug_active = true;
 	mutex_unlock(&tb->lock);
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 83bd2043bab2..09619190c34a 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -2170,12 +2170,12 @@ bool tb_tunnel_is_invalid(struct tb_tunnel *tunnel)
 }
 
 /**
- * tb_tunnel_restart() - activate a tunnel after a hardware reset
- * @tunnel: Tunnel to restart
+ * tb_tunnel_activate() - activate a tunnel
+ * @tunnel: Tunnel to activate
  *
  * Return: 0 on success and negative errno in case if failure
  */
-int tb_tunnel_restart(struct tb_tunnel *tunnel)
+int tb_tunnel_activate(struct tb_tunnel *tunnel)
 {
 	int res, i;
 
@@ -2218,27 +2218,6 @@ int tb_tunnel_restart(struct tb_tunnel *tunnel)
 	return res;
 }
 
-/**
- * tb_tunnel_activate() - activate a tunnel
- * @tunnel: Tunnel to activate
- *
- * Return: Returns 0 on success or an error code on failure.
- */
-int tb_tunnel_activate(struct tb_tunnel *tunnel)
-{
-	int i;
-
-	for (i = 0; i < tunnel->npaths; i++) {
-		if (tunnel->paths[i]->activated) {
-			tb_tunnel_WARN(tunnel,
-				       "trying to activate an already activated tunnel\n");
-			return -EINVAL;
-		}
-	}
-
-	return tb_tunnel_restart(tunnel);
-}
-
 /**
  * tb_tunnel_deactivate() - deactivate a tunnel
  * @tunnel: Tunnel to deactivate
diff --git a/drivers/thunderbolt/tunnel.h b/drivers/thunderbolt/tunnel.h
index 30c079fd121e..3d3ab180cb9b 100644
--- a/drivers/thunderbolt/tunnel.h
+++ b/drivers/thunderbolt/tunnel.h
@@ -106,7 +106,6 @@ struct tb_tunnel *tb_tunnel_alloc_usb3(struct tb *tb, struct tb_port *up,
 
 void tb_tunnel_free(struct tb_tunnel *tunnel);
 int tb_tunnel_activate(struct tb_tunnel *tunnel);
-int tb_tunnel_restart(struct tb_tunnel *tunnel);
 void tb_tunnel_deactivate(struct tb_tunnel *tunnel);
 bool tb_tunnel_is_invalid(struct tb_tunnel *tunnel);
 bool tb_tunnel_port_on_path(const struct tb_tunnel *tunnel,
-- 
2.45.2


  parent reply	other threads:[~2024-12-17  8:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17  8:22 [PATCH 00/12] thunderbolt: Improve DisplayPort tunneling Mika Westerberg
2024-12-17  8:22 ` [PATCH 01/12] thunderbolt: Drop doubled empty line from ctl.h Mika Westerberg
2024-12-17  8:22 ` [PATCH 02/12] thunderbolt: Log config space when invalid config space reply is received Mika Westerberg
2024-12-17  8:22 ` [PATCH 03/12] thunderbolt: Debug log an invalid config space reply just once Mika Westerberg
2024-12-17  8:22 ` [PATCH 04/12] thunderbolt: Increase DPRX capabilities read timeout Mika Westerberg
2024-12-17  8:22 ` [PATCH 05/12] thunderbolt: Make tb_tunnel_one_dp() return void Mika Westerberg
2024-12-17  8:22 ` [PATCH 06/12] thunderbolt: Show path name in debug log when path is deactivated Mika Westerberg
2024-12-17  8:22 ` [PATCH 07/12] thunderbolt: Rework how tunnel->[init|deinit] hooks are called Mika Westerberg
2024-12-17  8:22 ` Mika Westerberg [this message]
2024-12-17  8:22 ` [PATCH 09/12] thunderbolt: Pass reason to tb_dp_resource_unavailable() Mika Westerberg
2024-12-17  8:22 ` [PATCH 10/12] thunderbolt: Move forward declarations in one place Mika Westerberg
2024-12-17  8:22 ` [PATCH 11/12] thunderbolt: Rework tb_tunnel_consumed_bandwidth() Mika Westerberg
2024-12-17  8:22 ` [PATCH 12/12] thunderbolt: Handle DisplayPort tunnel activation asynchronously Mika Westerberg
2024-12-19 17:03   ` Lukas Wunner
2024-12-19 17:29     ` Mika Westerberg
2025-01-03  9:56 ` [PATCH 00/12] thunderbolt: Improve DisplayPort tunneling Mika Westerberg

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=20241217082222.528602-9-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.