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

PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg()

This interface is superseded by support in dma_map_sg() which now supports
heterogeneous scatterlists. There are no longer any users, so remove it.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Logan Gunthorpe and committed by
Christoph Hellwig
0d06132f 1e97af7f

-93
-66
drivers/pci/p2pdma.c
··· 872 872 return type; 873 873 } 874 874 875 - static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap, 876 - struct device *dev, struct scatterlist *sg, int nents) 877 - { 878 - struct scatterlist *s; 879 - int i; 880 - 881 - for_each_sg(sg, s, nents, i) { 882 - s->dma_address = sg_phys(s) + p2p_pgmap->bus_offset; 883 - sg_dma_len(s) = s->length; 884 - } 885 - 886 - return nents; 887 - } 888 - 889 - /** 890 - * pci_p2pdma_map_sg_attrs - map a PCI peer-to-peer scatterlist for DMA 891 - * @dev: device doing the DMA request 892 - * @sg: scatter list to map 893 - * @nents: elements in the scatterlist 894 - * @dir: DMA direction 895 - * @attrs: DMA attributes passed to dma_map_sg() (if called) 896 - * 897 - * Scatterlists mapped with this function should be unmapped using 898 - * pci_p2pdma_unmap_sg_attrs(). 899 - * 900 - * Returns the number of SG entries mapped or 0 on error. 901 - */ 902 - int pci_p2pdma_map_sg_attrs(struct device *dev, struct scatterlist *sg, 903 - int nents, enum dma_data_direction dir, unsigned long attrs) 904 - { 905 - struct pci_p2pdma_pagemap *p2p_pgmap = 906 - to_p2p_pgmap(sg_page(sg)->pgmap); 907 - 908 - switch (pci_p2pdma_map_type(sg_page(sg)->pgmap, dev)) { 909 - case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE: 910 - return dma_map_sg_attrs(dev, sg, nents, dir, attrs); 911 - case PCI_P2PDMA_MAP_BUS_ADDR: 912 - return __pci_p2pdma_map_sg(p2p_pgmap, dev, sg, nents); 913 - default: 914 - /* Mapping is not Supported */ 915 - return 0; 916 - } 917 - } 918 - EXPORT_SYMBOL_GPL(pci_p2pdma_map_sg_attrs); 919 - 920 - /** 921 - * pci_p2pdma_unmap_sg_attrs - unmap a PCI peer-to-peer scatterlist that was 922 - * mapped with pci_p2pdma_map_sg() 923 - * @dev: device doing the DMA request 924 - * @sg: scatter list to map 925 - * @nents: number of elements returned by pci_p2pdma_map_sg() 926 - * @dir: DMA direction 927 - * @attrs: DMA attributes passed to dma_unmap_sg() (if called) 928 - */ 929 - void pci_p2pdma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, 930 - int nents, enum dma_data_direction dir, unsigned long attrs) 931 - { 932 - enum pci_p2pdma_map_type map_type; 933 - 934 - map_type = pci_p2pdma_map_type(sg_page(sg)->pgmap, dev); 935 - 936 - if (map_type == PCI_P2PDMA_MAP_THRU_HOST_BRIDGE) 937 - dma_unmap_sg_attrs(dev, sg, nents, dir, attrs); 938 - } 939 - EXPORT_SYMBOL_GPL(pci_p2pdma_unmap_sg_attrs); 940 - 941 875 /** 942 876 * pci_p2pdma_map_segment - map an sg segment determining the mapping type 943 877 * @state: State structure that should be declared outside of the for_each_sg()
-27
include/linux/pci-p2pdma.h
··· 30 30 unsigned int *nents, u32 length); 31 31 void pci_p2pmem_free_sgl(struct pci_dev *pdev, struct scatterlist *sgl); 32 32 void pci_p2pmem_publish(struct pci_dev *pdev, bool publish); 33 - int pci_p2pdma_map_sg_attrs(struct device *dev, struct scatterlist *sg, 34 - int nents, enum dma_data_direction dir, unsigned long attrs); 35 - void pci_p2pdma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, 36 - int nents, enum dma_data_direction dir, unsigned long attrs); 37 33 int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev, 38 34 bool *use_p2pdma); 39 35 ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev, ··· 79 83 static inline void pci_p2pmem_publish(struct pci_dev *pdev, bool publish) 80 84 { 81 85 } 82 - static inline int pci_p2pdma_map_sg_attrs(struct device *dev, 83 - struct scatterlist *sg, int nents, enum dma_data_direction dir, 84 - unsigned long attrs) 85 - { 86 - return 0; 87 - } 88 - static inline void pci_p2pdma_unmap_sg_attrs(struct device *dev, 89 - struct scatterlist *sg, int nents, enum dma_data_direction dir, 90 - unsigned long attrs) 91 - { 92 - } 93 86 static inline int pci_p2pdma_enable_store(const char *page, 94 87 struct pci_dev **p2p_dev, bool *use_p2pdma) 95 88 { ··· 102 117 static inline struct pci_dev *pci_p2pmem_find(struct device *client) 103 118 { 104 119 return pci_p2pmem_find_many(&client, 1); 105 - } 106 - 107 - static inline int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg, 108 - int nents, enum dma_data_direction dir) 109 - { 110 - return pci_p2pdma_map_sg_attrs(dev, sg, nents, dir, 0); 111 - } 112 - 113 - static inline void pci_p2pdma_unmap_sg(struct device *dev, 114 - struct scatterlist *sg, int nents, enum dma_data_direction dir) 115 - { 116 - pci_p2pdma_unmap_sg_attrs(dev, sg, nents, dir, 0); 117 120 } 118 121 119 122 #endif /* _LINUX_PCI_P2P_H */