Skip to content

Commit 7c2308f

Browse files
Christoph Hellwigbjorn-helgaas
authored andcommitted
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: 2f9237d ("dma-mapping: make support for dma ops optional") Link: https://lore.kernel.org/r/[email protected] Reported-by: Matthew Wilcox <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Logan Gunthorpe <[email protected]>
1 parent 9123e3a commit 7c2308f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/pci/p2pdma.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,
556556
return -1;
557557

558558
for (i = 0; i < num_clients; i++) {
559-
if (IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
560-
clients[i]->dma_ops == &dma_virt_ops) {
559+
#ifdef CONFIG_DMA_VIRT_OPS
560+
if (clients[i]->dma_ops == &dma_virt_ops) {
561561
if (verbose)
562562
dev_warn(clients[i],
563563
"cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n");
564564
return -1;
565565
}
566+
#endif
566567

567568
pci_client = find_parent_pci_dev(clients[i]);
568569
if (!pci_client) {
@@ -842,9 +843,10 @@ static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap,
842843
* this should never happen because it will be prevented
843844
* by the check in pci_p2pdma_distance_many()
844845
*/
845-
if (WARN_ON_ONCE(IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
846-
dev->dma_ops == &dma_virt_ops))
846+
#ifdef CONFIG_DMA_VIRT_OPS
847+
if (WARN_ON_ONCE(dev->dma_ops == &dma_virt_ops))
847848
return 0;
849+
#endif
848850

849851
for_each_sg(sg, s, nents, i) {
850852
paddr = sg_phys(s);

0 commit comments

Comments
 (0)