summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-10-04 14:19:20 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2018-03-09 10:54:10 +0100
commitb6b0ea70f4254139e204870937cdb24d88dfac68 (patch)
treef4792fa84b8cb75c1a5d8f688a3979e7007c873e /drivers/thunderbolt
parentthunderbolt: Correct function name in kernel-doc comment (diff)
downloadlinux-b6b0ea70f4254139e204870937cdb24d88dfac68.tar.xz
linux-b6b0ea70f4254139e204870937cdb24d88dfac68.zip
thunderbolt: Add tb_switch_get()
Sometimes there is need for increasing reference count of a switch as well. This also follows what we have for xdomains. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/tb.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 895c57a0a090..c7bd77e9c2c3 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -387,6 +387,13 @@ struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link,
u8 depth);
struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid);
+static inline struct tb_switch *tb_switch_get(struct tb_switch *sw)
+{
+ if (sw)
+ get_device(&sw->dev);
+ return sw;
+}
+
static inline void tb_switch_put(struct tb_switch *sw)
{
put_device(&sw->dev);