Blob Blame History Raw
From b6b0ea70f4254139e204870937cdb24d88dfac68 Mon Sep 17 00:00:00 2001
From: Mika Westerberg <mika.westerberg@linux.intel.com>
Date: Wed, 4 Oct 2017 15:19:20 +0300
Subject: [PATCH] thunderbolt: Add tb_switch_get()
Git-commit: b6b0ea70f4254139e204870937cdb24d88dfac68
Patch-mainline: v4.17
References: FATE#324324

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>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/thunderbolt/tb.h |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -393,6 +393,13 @@ static inline unsigned int tb_switch_phy
 	return (link - 1) / TB_LINKS_PER_PHY_PORT;
 }
 
+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);