summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/clx.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2022-11-18 16:42:27 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-06-09 12:07:24 +0300
commit4a420eb1426a237aaf105c9d040644785fc2c7fa (patch)
tree81dfab4e0cea2bf30a87c46d30e313afb1bd5841 /drivers/thunderbolt/clx.c
parent768e6fe69fde546beb942344c4c4932f3b3bb55b (diff)
downloadlinux-4a420eb1426a237aaf105c9d040644785fc2c7fa.tar.xz
thunderbolt: Make tb_switch_clx_disable() return CL states that were enabled
This allows us to disable all CL states temporarily when running lane margining and then return back the previously enabled states. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/clx.c')
-rw-r--r--drivers/thunderbolt/clx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/thunderbolt/clx.c b/drivers/thunderbolt/clx.c
index 960409df4405..4f0cfbb24dd9 100644
--- a/drivers/thunderbolt/clx.c
+++ b/drivers/thunderbolt/clx.c
@@ -317,6 +317,9 @@ int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx)
struct tb_port *up, *down;
int ret;
+ if (!clx)
+ return 0;
+
if (!validate_mask(clx))
return -EINVAL;
@@ -380,7 +383,8 @@ int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx)
* Disables all CL states of the given router. Can be called on any
* router and if the states were not enabled already does nothing.
*
- * Returns %0 on success or an error code on failure.
+ * Returns the CL states that were disabled or negative errno in case of
+ * failure.
*/
int tb_switch_clx_disable(struct tb_switch *sw)
{
@@ -408,5 +412,5 @@ int tb_switch_clx_disable(struct tb_switch *sw)
sw->clx = 0;
tb_sw_dbg(sw, "CLx: %s disabled\n", clx_name(clx));
- return 0;
+ return clx;
}