PCI/P2PDMA: fix build without dma ops
Subsystems (2)
PATCH 1/1 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.
--- drivers/pci/p2pdma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/pci/p2pdma.c +6 -4
@@ -556,13 +556,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,return -1 ;for (i =0 ; i < num_clients; i++) { -if (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && - clients[i]->dma_ops == &dma_virt_ops) { +#ifdef CONFIG_DMA_VIRT_OPS +if (clients[i]->dma_ops == &dma_virt_ops) {if (verbose)dev_warn (clients[i],"cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n" );return -1 ; } +#endif pci_client =find_parent_pci_dev (clients[i]);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 * by the check in pci_p2pdma_distance_many() */ -if (WARN_ON_ONCE (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && - dev->dma_ops == &dma_virt_ops)) +#ifdef CONFIG_DMA_VIRT_OPS +if (WARN_ON_ONCE (dev->dma_ops == &dma_virt_ops))return 0 ; +#endif for_each_sg (sg, s, nents, i) { paddr =sg_phys (s);
Signature · 1 line
2.28.0
Quoted 4 lines · Christoph Hellwig
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_ENABLEDchecks with ifdefs.
Makes sense to me.
Quoted 42 lines
Fixes 2f9237d4f6d ("dma-mapping: make support for dma ops optional")Reported-by Matthew Wilcox <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>--- drivers/pci/p2pdma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/pci/p2pdma.c +6
-4@@ -556,13 +556,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,return -1 ;for (i =0 ; i < num_clients; i++) { -if (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && - clients[i]->dma_ops == &dma_virt_ops) { +#ifdef CONFIG_DMA_VIRT_OPS +if (clients[i]->dma_ops == &dma_virt_ops) {if (verbose)dev_warn (clients[i],"cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n" );return -1 ; } +#endif pci_client =find_parent_pci_dev (clients[i]);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 * by the check in pci_p2pdma_distance_many() */ -if (WARN_ON_ONCE (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && - dev->dma_ops == &dma_virt_ops)) +#ifdef CONFIG_DMA_VIRT_OPS +if (WARN_ON_ONCE (dev->dma_ops == &dma_virt_ops))return 0 ; +#endif for_each_sg (sg, s, nents, i) { paddr =sg_phys (s);
Quoted 8 lines · Christoph Hellwig
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_ENABLEDchecks with ifdefs.Fixes 2f9237d4f6d ("dma-mapping: make support for dma ops optional")Reported-by Matthew Wilcox <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Applied with Logan's reviewed-by to for-linus for v5.9, thanks!
Quoted 41 lines
--- drivers/pci/p2pdma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/pci/p2pdma.c +6
-4@@ -556,13 +556,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,return -1 ;for (i =0 ; i < num_clients; i++) { -if (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && - clients[i]->dma_ops == &dma_virt_ops) { +#ifdef CONFIG_DMA_VIRT_OPS +if (clients[i]->dma_ops == &dma_virt_ops) {if (verbose)dev_warn (clients[i],"cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n" );return -1 ; } +#endif pci_client =find_parent_pci_dev (clients[i]);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 * by the check in pci_p2pdma_distance_many() */ -if (WARN_ON_ONCE (IS_ENABLED (CONFIG_DMA_VIRT_OPS ) && - dev->dma_ops == &dma_virt_ops)) +#ifdef CONFIG_DMA_VIRT_OPS +if (WARN_ON_ONCE (dev->dma_ops == &dma_virt_ops))return 0 ; +#endif for_each_sg (sg, s, nents, i) { paddr =sg_phys (s);Signature · 1 line
2.28.0