PCI/P2PDMA: Fix build without DMA ops
My commit to make DMA ops support optional missed the reference in
the p2pdma code. And while the build bot didn't manage to find a config
where this can happen, Matthew did. Fix this by replacing two IS_ENABLED
checks with ifdefs.
Fixes: 2f9237d4f6
("dma-mapping: make support for dma ops optional")
Link: https://lore.kernel.org/r/20200810124843.1532738-1-hch@lst.de
Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
This commit is contained in:
parent
9123e3a74e
commit
7c2308f79f
|
@ -556,13 +556,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < num_clients; i++) {
|
for (i = 0; i < num_clients; i++) {
|
||||||
if (IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
|
#ifdef CONFIG_DMA_VIRT_OPS
|
||||||
clients[i]->dma_ops == &dma_virt_ops) {
|
if (clients[i]->dma_ops == &dma_virt_ops) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
dev_warn(clients[i],
|
dev_warn(clients[i],
|
||||||
"cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n");
|
"cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
pci_client = find_parent_pci_dev(clients[i]);
|
pci_client = find_parent_pci_dev(clients[i]);
|
||||||
if (!pci_client) {
|
if (!pci_client) {
|
||||||
|
@ -842,9 +843,10 @@ static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap,
|
||||||
* this should never happen because it will be prevented
|
* this should never happen because it will be prevented
|
||||||
* by the check in pci_p2pdma_distance_many()
|
* by the check in pci_p2pdma_distance_many()
|
||||||
*/
|
*/
|
||||||
if (WARN_ON_ONCE(IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
|
#ifdef CONFIG_DMA_VIRT_OPS
|
||||||
dev->dma_ops == &dma_virt_ops))
|
if (WARN_ON_ONCE(dev->dma_ops == &dma_virt_ops))
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
for_each_sg(sg, s, nents, i) {
|
for_each_sg(sg, s, nents, i) {
|
||||||
paddr = sg_phys(s);
|
paddr = sg_phys(s);
|
||||||
|
|
Loading…
Reference in New Issue