summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/tb.h
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2019-06-25 15:10:01 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2019-11-01 14:31:59 +0300
commitf07a360813f6c551380dca8817d8eb5e7ab40a21 (patch)
tree585e2ecadbb618d9473dd3bae5b8cc0620496f51 /drivers/thunderbolt/tb.h
parent1c9c5bc525b592e4b26cb5182d813e4b84bafa6e (diff)
downloadlinux-stable-f07a360813f6c551380dca8817d8eb5e7ab40a21.tar.gz
linux-stable-f07a360813f6c551380dca8817d8eb5e7ab40a21.tar.bz2
linux-stable-f07a360813f6c551380dca8817d8eb5e7ab40a21.zip
thunderbolt: Introduce tb_switch_is_icm()
We currently differentiate between SW CM (Software Connection Manager, sometimes also called External Connection Manager) and ICM (Firmware based Connection Manager, Internal Connection Manager) by looking directly at the sw->config.enabled field which may be rather hard to understand for the casual reader. For this reason introduce a wrapper function with documentation that should make the intention more clear. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tb.h')
-rw-r--r--drivers/thunderbolt/tb.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 6407d529871d..1565af2e48cb 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -591,6 +591,20 @@ static inline bool tb_switch_is_fr(const struct tb_switch *sw)
}
}
+/**
+ * tb_switch_is_icm() - Is the switch handled by ICM firmware
+ * @sw: Switch to check
+ *
+ * In case there is a need to differentiate whether ICM firmware or SW CM
+ * is handling @sw this function can be called. It is valid to call this
+ * after tb_switch_alloc() and tb_switch_configure() has been called
+ * (latter only for SW CM case).
+ */
+static inline bool tb_switch_is_icm(const struct tb_switch *sw)
+{
+ return !sw->config.enabled;
+}
+
int tb_wait_for_port(struct tb_port *port, bool wait_if_unplugged);
int tb_port_add_nfc_credits(struct tb_port *port, int credits);
int tb_port_set_initial_credits(struct tb_port *port, u32 credits);