Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734233

[PATCH 14/16] thunderbolt: Add function to retrieve DMA device for the ring

From Mika Westerberg <mika.westerberg@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 14/16] thunderbolt: Add function to retrieve DMA device for the ring
Date 2017-09-18 17:40 +0200
Message-ID <ur6jp-85s-27@gated-at.bofh.it> (permalink)
References <ur6jo-85s-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 include/linux/thunderbolt.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h
index 9a63210d5084..d479a9e508cd 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_ */
-- 
2.13.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/16] Thunderbolt networking Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 03/16] thunderbolt: Move enum tb_cfg_pkg_type to thunderbolt.h Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 05/16] thunderbolt: Move tb_switch_phy_port_from_link() to thunderbolt.h Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 14/16] thunderbolt: Add function to retrieve DMA device for the ring Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 09/16] thunderbolt: Export ring handling functions to modules Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 12/16] thunderbolt: Use spinlock in NHI serialization Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 15/16] thunderbolt: Allocate ring HopID automatically if requested Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 10/16] thunderbolt: Move ring descriptor flags to thunderbolt.h Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 13/16] thunderbolt: Add polling mode for rings Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 02/16] thunderbolt: Add support for XDomain properties Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 08/16] thunderbolt: Add support for frame mode Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 11/16] thunderbolt: Use spinlock in ring serialization Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  [PATCH 07/16] thunderbolt: Configure interrupt throttling for all interrupts Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-18 17:40 +0200
  Re: [PATCH 16/16] thunderbolt: Add support for networking over  Thunderbolt cable Andrew Lunn <andrew@lunn.ch> - 2017-09-19 01:30 +0200
    Re: [PATCH 16/16] thunderbolt: Add support for networking over  Thunderbolt cable Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-19 09:20 +0200
  Re: [PATCH 06/16] thunderbolt: Add support for XDomain discovery  protocol Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-19 09:50 +0200

csiph-web