Skip to content

Commit 0d06132

Browse files
lsgunthChristoph Hellwig
authored andcommitted
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>
1 parent 1e97af7 commit 0d06132

2 files changed

Lines changed: 0 additions & 93 deletions

File tree

drivers/pci/p2pdma.c

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -872,72 +872,6 @@ static enum pci_p2pdma_map_type pci_p2pdma_map_type(struct dev_pagemap *pgmap,
872872
return type;
873873
}
874874

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-
941875
/**
942876
* pci_p2pdma_map_segment - map an sg segment determining the mapping type
943877
* @state: State structure that should be declared outside of the for_each_sg()

include/linux/pci-p2pdma.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ struct scatterlist *pci_p2pmem_alloc_sgl(struct pci_dev *pdev,
3030
unsigned int *nents, u32 length);
3131
void pci_p2pmem_free_sgl(struct pci_dev *pdev, struct scatterlist *sgl);
3232
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);
3733
int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev,
3834
bool *use_p2pdma);
3935
ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev,
@@ -83,17 +79,6 @@ static inline void pci_p2pmem_free_sgl(struct pci_dev *pdev,
8379
static inline void pci_p2pmem_publish(struct pci_dev *pdev, bool publish)
8480
{
8581
}
86-
static inline int pci_p2pdma_map_sg_attrs(struct device *dev,
87-
struct scatterlist *sg, int nents, enum dma_data_direction dir,
88-
unsigned long attrs)
89-
{
90-
return 0;
91-
}
92-
static inline void pci_p2pdma_unmap_sg_attrs(struct device *dev,
93-
struct scatterlist *sg, int nents, enum dma_data_direction dir,
94-
unsigned long attrs)
95-
{
96-
}
9782
static inline int pci_p2pdma_enable_store(const char *page,
9883
struct pci_dev **p2p_dev, bool *use_p2pdma)
9984
{
@@ -119,16 +104,4 @@ static inline struct pci_dev *pci_p2pmem_find(struct device *client)
119104
return pci_p2pmem_find_many(&client, 1);
120105
}
121106

122-
static inline int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg,
123-
int nents, enum dma_data_direction dir)
124-
{
125-
return pci_p2pdma_map_sg_attrs(dev, sg, nents, dir, 0);
126-
}
127-
128-
static inline void pci_p2pdma_unmap_sg(struct device *dev,
129-
struct scatterlist *sg, int nents, enum dma_data_direction dir)
130-
{
131-
pci_p2pdma_unmap_sg_attrs(dev, sg, nents, dir, 0);
132-
}
133-
134107
#endif /* _LINUX_PCI_P2P_H */

0 commit comments

Comments
 (0)