* [PATCH] PCI/P2PDMA: fix build without dma ops
@ 2020-08-10 12:48 Christoph Hellwig
2020-08-10 15:55 ` Logan Gunthorpe
2020-08-17 19:51 ` Bjorn Helgaas
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-08-10 12:48 UTC (permalink / raw)
To: logang, bhelgaas; +Cc: linux-pci, Matthew Wilcox
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: 2f9237d4f6d ("dma-mapping: make support for dma ops optional")
Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/pci/p2pdma.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 64ebed129dbf5f..f357f9a32b3a57 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -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);
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI/P2PDMA: fix build without dma ops
2020-08-10 12:48 [PATCH] PCI/P2PDMA: fix build without dma ops Christoph Hellwig
@ 2020-08-10 15:55 ` Logan Gunthorpe
2020-08-17 19:51 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2020-08-10 15:55 UTC (permalink / raw)
To: Christoph Hellwig, bhelgaas; +Cc: linux-pci, Matthew Wilcox
On 2020-08-10 6:48 a.m., Christoph Hellwig wrote:
> 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.
Makes sense to me.
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
> Fixes: 2f9237d4f6d ("dma-mapping: make support for dma ops optional")
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/pci/p2pdma.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index 64ebed129dbf5f..f357f9a32b3a57 100644
> --- a/drivers/pci/p2pdma.c
> +++ b/drivers/pci/p2pdma.c
> @@ -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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI/P2PDMA: fix build without dma ops
2020-08-10 12:48 [PATCH] PCI/P2PDMA: fix build without dma ops Christoph Hellwig
2020-08-10 15:55 ` Logan Gunthorpe
@ 2020-08-17 19:51 ` Bjorn Helgaas
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2020-08-17 19:51 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: logang, bhelgaas, linux-pci, Matthew Wilcox
On Mon, Aug 10, 2020 at 02:48:43PM +0200, Christoph Hellwig wrote:
> 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: 2f9237d4f6d ("dma-mapping: make support for dma ops optional")
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Applied with Logan's reviewed-by to for-linus for v5.9, thanks!
> ---
> drivers/pci/p2pdma.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index 64ebed129dbf5f..f357f9a32b3a57 100644
> --- a/drivers/pci/p2pdma.c
> +++ b/drivers/pci/p2pdma.c
> @@ -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);
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-17 19:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 12:48 [PATCH] PCI/P2PDMA: fix build without dma ops Christoph Hellwig
2020-08-10 15:55 ` Logan Gunthorpe
2020-08-17 19:51 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).