Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+30 -30
-12
drivers/pci/pci.c
··· 3385 3385 } 3386 3386 EXPORT_SYMBOL_GPL(pci_check_and_unmask_intx); 3387 3387 3388 - int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size) 3389 - { 3390 - return dma_set_max_seg_size(&dev->dev, size); 3391 - } 3392 - EXPORT_SYMBOL(pci_set_dma_max_seg_size); 3393 - 3394 - int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask) 3395 - { 3396 - return dma_set_seg_boundary(&dev->dev, mask); 3397 - } 3398 - EXPORT_SYMBOL(pci_set_dma_seg_boundary); 3399 - 3400 3388 /** 3401 3389 * pci_wait_for_pending_transaction - waits for pending transaction 3402 3390 * @dev: the PCI device to operate on
+29
include/linux/pci-dma-compat.h
··· 6 6 7 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 + 9 15 static inline void * 10 16 pci_alloc_consistent(struct pci_dev *hwdev, size_t size, 11 17 dma_addr_t *dma_handle) ··· 119 113 { 120 114 return dma_set_coherent_mask(&dev->dev, mask); 121 115 } 116 + 117 + static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, 118 + unsigned int size) 119 + { 120 + return dma_set_max_seg_size(&dev->dev, size); 121 + } 122 + 123 + static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, 124 + unsigned long mask) 125 + { 126 + return dma_set_seg_boundary(&dev->dev, mask); 127 + } 128 + #else 129 + static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) 130 + { return -EIO; } 131 + static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) 132 + { return -EIO; } 133 + static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, 134 + unsigned int size) 135 + { return -EIO; } 136 + static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, 137 + unsigned long mask) 138 + { return -EIO; } 122 139 #endif 123 140 124 141 #endif
+1 -18
include/linux/pci.h
··· 70 70 pci_mmap_mem 71 71 }; 72 72 73 - /* This defines the direction arg to the DMA mapping routines. */ 74 - #define PCI_DMA_BIDIRECTIONAL 0 75 - #define PCI_DMA_TODEVICE 1 76 - #define PCI_DMA_FROMDEVICE 2 77 - #define PCI_DMA_NONE 3 78 - 79 73 /* 80 74 * For PCI devices, the region numbers are assigned this way: 81 75 */ ··· 1032 1038 bool pci_intx_mask_supported(struct pci_dev *dev); 1033 1039 bool pci_check_and_mask_intx(struct pci_dev *dev); 1034 1040 bool pci_check_and_unmask_intx(struct pci_dev *dev); 1035 - int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 1036 - int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 1037 1041 int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask); 1038 1042 int pci_wait_for_pending_transaction(struct pci_dev *dev); 1039 1043 int pcix_get_max_mmrbc(struct pci_dev *dev); ··· 1247 1255 1248 1256 int pci_set_vga_state(struct pci_dev *pdev, bool decode, 1249 1257 unsigned int command_bits, u32 flags); 1258 + 1250 1259 /* kmem_cache style wrapper around pci_alloc_consistent() */ 1251 1260 1252 1261 #include <linux/pci-dma.h> ··· 1459 1466 static inline void pci_set_master(struct pci_dev *dev) { } 1460 1467 static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } 1461 1468 static inline void pci_disable_device(struct pci_dev *dev) { } 1462 - static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) 1463 - { return -EIO; } 1464 - static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) 1465 - { return -EIO; } 1466 - static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, 1467 - unsigned int size) 1468 - { return -EIO; } 1469 - static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, 1470 - unsigned long mask) 1471 - { return -EIO; } 1472 1469 static inline int pci_assign_resource(struct pci_dev *dev, int i) 1473 1470 { return -EBUSY; } 1474 1471 static inline int __pci_register_driver(struct pci_driver *drv,