aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/thunderbolt.h
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-10-02 13:38:42 +0300
committerDavid S. Miller <davem@davemloft.net>2017-10-02 11:24:41 -0700
commit3304559e353f098d7e0ed5ca981e26c406513e12 (patch)
tree09481629e751d4d853adb460e940779e384e5713 /include/linux/thunderbolt.h
parentthunderbolt: Add polling mode for rings (diff)
downloadlinux-dev-3304559e353f098d7e0ed5ca981e26c406513e12.tar.xz
linux-dev-3304559e353f098d7e0ed5ca981e26c406513e12.zip
thunderbolt: Add function to retrieve DMA device for the ring
This is needed when Thunderbolt service drivers need to DMA map memory before it is passed down to the ring. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Michael Jamet <michael.jamet@intel.com> Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/thunderbolt.h')
-rw-r--r--include/linux/thunderbolt.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h
index 36925e3aec7c..7b69853188b1 100644
--- a/include/linux/thunderbolt.h
+++ b/include/linux/thunderbolt.h
@@ -19,6 +19,7 @@
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/mod_devicetable.h>
+#include <linux/pci.h>
#include <linux/uuid.h>
#include <linux/workqueue.h>
@@ -582,4 +583,16 @@ static inline int tb_ring_tx(struct tb_ring *ring, struct ring_frame *frame)
struct ring_frame *tb_ring_poll(struct tb_ring *ring);
void tb_ring_poll_complete(struct tb_ring *ring);
+/**
+ * tb_ring_dma_device() - Return device used for DMA mapping
+ * @ring: Ring whose DMA device is retrieved
+ *
+ * Use this function when you are mapping DMA for buffers that are
+ * passed to the ring for sending/receiving.
+ */
+static inline struct device *tb_ring_dma_device(struct tb_ring *ring)
+{
+ return &ring->nhi->pdev->dev;
+}
+
#endif /* THUNDERBOLT_H_ */