diff mbox series

[v1] PCI/P2PDMA: Use DMA ops setter instead of direct assignment

Message ID 20200828111157.7639-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1] PCI/P2PDMA: Use DMA ops setter instead of direct assignment | expand

Commit Message

Andy Shevchenko Aug. 28, 2020, 11:11 a.m. UTC
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(-)

Comments

Christoph Hellwig Aug. 29, 2020, 7:08 a.m. UTC | #1
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.
diff mbox series

Patch

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