[PATCH 05/13][SRU][U/OEM-5.10] UBUNTU: SAUCE: thunderbolt: Return -ENOTCONN when ERR_CONN is received

You-Sheng Yang vicamo.yang at canonical.com
Thu Dec 3 08:18:44 UTC 2020


From: Mika Westerberg <mika.westerberg at linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1906236

This allows the calling code to distinguish if the error was due to
ERR_CONN (adapter is disconneced or disabled) or something else. Will be
needed in USB4 router NVM update in the following patch.

Signed-off-by: Mika Westerberg <mika.westerberg at linux.intel.com>
(cherry picked from commit 463e48fa544826898791085508459de246fc4c09
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
 drivers/thunderbolt/ctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index 9894b8f63064..22f55a9291f3 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -962,6 +962,9 @@ static int tb_cfg_get_error(struct tb_ctl *ctl, enum tb_cfg_space space,
 
 	if (res->tb_error == TB_CFG_ERROR_LOCK)
 		return -EACCES;
+	else if (res->tb_error == TB_CFG_ERROR_PORT_NOT_CONNECTED)
+		return -ENOTCONN;
+
 	return -EIO;
 }
 
-- 
2.29.2




More information about the kernel-team mailing list