aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci-dma-compat.h
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-03-07 12:39:16 -0500
committerBjorn Helgaas <bhelgaas@google.com>2016-03-07 12:39:16 -0500
commitfe537670eab767157eecc50538bd28e8d9b0ce9f (patch)
tree99314e763b2b8400974d5ab233c813495ed58098 /include/linux/pci-dma-compat.h
parentbc4b024a8b8bd7dceb2697299aad2bda57d065e0 (diff)
PCI: Consolidate PCI DMA constants and interfaces in linux/pci-dma-compat.h
Christoph added a generic include/linux/pci-dma-compat.h, so now there's one place with most of the PCI DMA interfaces. Move more PCI DMA-related things there: - The PCI_DMA_* direction constants from linux/pci.h - The pci_set_dma_max_seg_size() and pci_set_dma_seg_boundary() CONFIG_PCI implementations from drivers/pci/pci.c - The pci_set_dma_max_seg_size() and pci_set_dma_seg_boundary() !CONFIG_PCI stubs from linux/pci.h - The pci_set_dma_mask() and pci_set_consistent_dma_mask() !CONFIG_PCI stubs from linux/pci.h Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include/linux/pci-dma-compat.h')
-rw-r--r--include/linux/pci-dma-compat.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h
index eafce7b6f052..39726caef5b1 100644
--- a/include/linux/pci-dma-compat.h
+++ b/include/linux/pci-dma-compat.h
@@ -6,6 +6,12 @@
6 6
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8 8
9/* This defines the direction arg to the DMA mapping routines. */
10#define PCI_DMA_BIDIRECTIONAL 0
11#define PCI_DMA_TODEVICE 1
12#define PCI_DMA_FROMDEVICE 2
13#define PCI_DMA_NONE 3
14
9static inline void * 15static inline void *
10pci_alloc_consistent(struct pci_dev *hwdev, size_t size, 16pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
11 dma_addr_t *dma_handle) 17 dma_addr_t *dma_handle)
@@ -113,6 +119,29 @@ static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
113{ 119{
114 return dma_set_coherent_mask(&dev->dev, mask); 120 return dma_set_coherent_mask(&dev->dev, mask);
115} 121}
122
123static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
124 unsigned int size)
125{
126 return dma_set_max_seg_size(&dev->dev, size);
127}
128
129static inline int pci_set_dma_seg_boundary(struct pci_dev *dev,
130 unsigned long mask)
131{
132 return dma_set_seg_boundary(&dev->dev, mask);
133}
134#else
135static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
136{ return -EIO; }
137static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
138{ return -EIO; }
139static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
140 unsigned int size)
141{ return -EIO; }
142static inline int pci_set_dma_seg_boundary(struct pci_dev *dev,
143 unsigned long mask)
144{ return -EIO; }
116#endif 145#endif
117 146
118#endif 147#endif