Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1658701 > unrolled thread

[PATCH v4 02/27] thunderbolt: No need to read UID of the root switch on resume

Started byMika Westerberg <mika.westerberg@linux.intel.com>
First post2017-06-06 14:30 +0200
Last post2017-06-06 15:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 02/27] thunderbolt: No need to read UID of the root switch on resume Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-06-06 14:30 +0200
    Re: [PATCH v4 02/27] thunderbolt: No need to read UID of the root  switch on resume Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-06-06 15:10 +0200

#1658701 — [PATCH v4 02/27] thunderbolt: No need to read UID of the root switch on resume

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2017-06-06 14:30 +0200
Subject[PATCH v4 02/27] thunderbolt: No need to read UID of the root switch on resume
Message-ID<tPlMu-hV-15@gated-at.bofh.it>
The root switch is part of the host controller and cannot be physically
removed, so there is no point of reading UID again on resume in order to
check if the root switch is still the same.

Suggested-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
---
 drivers/thunderbolt/switch.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index c6f30b1695a9..81f5164a6364 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -452,19 +452,26 @@ void tb_sw_set_unplugged(struct tb_switch *sw)
 int tb_switch_resume(struct tb_switch *sw)
 {
 	int i, err;
-	u64 uid;
 	tb_sw_info(sw, "resuming switch\n");
 
-	err = tb_drom_read_uid_only(sw, &uid);
-	if (err) {
-		tb_sw_warn(sw, "uid read failed\n");
-		return err;
-	}
-	if (sw != sw->tb->root_switch && sw->uid != uid) {
-		tb_sw_info(sw,
-			"changed while suspended (uid %#llx -> %#llx)\n",
-			sw->uid, uid);
-		return -ENODEV;
+	/*
+	 * Check for UID of the connected switches except for root
+	 * switch which we assume cannot be removed.
+	 */
+	if (tb_route(sw)) {
+		u64 uid;
+
+		err = tb_drom_read_uid_only(sw, &uid);
+		if (err) {
+			tb_sw_warn(sw, "uid read failed\n");
+			return err;
+		}
+		if (sw->uid != uid) {
+			tb_sw_info(sw,
+				"changed while suspended (uid %#llx -> %#llx)\n",
+				sw->uid, uid);
+			return -ENODEV;
+		}
 	}
 
 	/* upload configuration */
-- 
2.11.0

[toc] | [next] | [standalone]


#1658752 — Re: [PATCH v4 02/27] thunderbolt: No need to read UID of the root switch on resume

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-06-06 15:10 +0200
SubjectRe: [PATCH v4 02/27] thunderbolt: No need to read UID of the root switch on resume
Message-ID<tPmpc-OH-15@gated-at.bofh.it>
In reply to#1658701
On Tue, 2017-06-06 at 15:24 +0300, Mika Westerberg wrote:
> The root switch is part of the host controller and cannot be
> physically
> removed, so there is no point of reading UID again on resume in order
> to
> check if the root switch is still the same.
> 

FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


> Suggested-by: Andreas Noever <andreas.noever@gmail.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
> ---
>  drivers/thunderbolt/switch.c | 29 ++++++++++++++++++-----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/thunderbolt/switch.c
> b/drivers/thunderbolt/switch.c
> index c6f30b1695a9..81f5164a6364 100644
> --- a/drivers/thunderbolt/switch.c
> +++ b/drivers/thunderbolt/switch.c
> @@ -452,19 +452,26 @@ void tb_sw_set_unplugged(struct tb_switch *sw)
>  int tb_switch_resume(struct tb_switch *sw)
>  {
>  	int i, err;
> -	u64 uid;
>  	tb_sw_info(sw, "resuming switch\n");
>  
> -	err = tb_drom_read_uid_only(sw, &uid);
> -	if (err) {
> -		tb_sw_warn(sw, "uid read failed\n");
> -		return err;
> -	}
> -	if (sw != sw->tb->root_switch && sw->uid != uid) {
> -		tb_sw_info(sw,
> -			"changed while suspended (uid %#llx ->
> %#llx)\n",
> -			sw->uid, uid);
> -		return -ENODEV;
> +	/*
> +	 * Check for UID of the connected switches except for root
> +	 * switch which we assume cannot be removed.
> +	 */
> +	if (tb_route(sw)) {
> +		u64 uid;
> +
> +		err = tb_drom_read_uid_only(sw, &uid);
> +		if (err) {
> +			tb_sw_warn(sw, "uid read failed\n");
> +			return err;
> +		}
> +		if (sw->uid != uid) {
> +			tb_sw_info(sw,
> +				"changed while suspended (uid %#llx
> -> %#llx)\n",
> +				sw->uid, uid);
> +			return -ENODEV;
> +		}
>  	}
>  
>  	/* upload configuration */

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web