linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] PCI/P2PDMA: Use DMA ops setter instead of direct assignment
@ 2020-08-28 11:11 Andy Shevchenko
  2020-08-29  7:08 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-08-28 11:11 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci; +Cc: Andy Shevchenko

Use DMA ops setter instead of direct assignment. Even we know that
this module doesn't perform access to the dma_ops member of struct device,
it's better to use setter to avoid potential problems in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pci/p2pdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 9d53c16b7329..2176223f972e 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -557,7 +557,7 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,
 
 	for (i = 0; i < num_clients; i++) {
 #ifdef CONFIG_DMA_VIRT_OPS
-		if (clients[i]->dma_ops == &dma_virt_ops) {
+		if (get_dma_ops(clients[i]) == &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");
@@ -844,7 +844,7 @@ static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap,
 	 * by the check in pci_p2pdma_distance_many()
 	 */
 #ifdef CONFIG_DMA_VIRT_OPS
-	if (WARN_ON_ONCE(dev->dma_ops == &dma_virt_ops))
+	if (WARN_ON_ONCE(get_dma_ops(dev) == &dma_virt_ops))
 		return 0;
 #endif
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] PCI/P2PDMA: Use DMA ops setter instead of direct assignment
  2020-08-28 11:11 [PATCH v1] PCI/P2PDMA: Use DMA ops setter instead of direct assignment Andy Shevchenko
@ 2020-08-29  7:08 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2020-08-29  7:08 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Bjorn Helgaas, linux-pci

On Fri, Aug 28, 2020 at 02:11:57PM +0300, Andy Shevchenko wrote:
> Use DMA ops setter instead of direct assignment. Even we know that
> this module doesn't perform access to the dma_ops member of struct device,
> it's better to use setter to avoid potential problems in the future.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

As mentioned in reply to the intel-iommu patch: I plan to remove these
accessors soon.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-29  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 11:11 [PATCH v1] PCI/P2PDMA: Use DMA ops setter instead of direct assignment Andy Shevchenko
2020-08-29  7:08 ` Christoph Hellwig

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).