Subject: [Very RFC 39/46] powernv/npu: Avoid pci_dn when mapping device_node to a pci_dev

From: Oliver O'Halloran <[email-masked]>
Date: Wed, 20 Nov 2019 12:28:52 +1100

There's no need to use the pci_dn to find a device_node from a pci_dev.
Just search for the node pointed to by the pci_dev's of_node pointer.

Signed-off-by: Oliver O'Halloran <[email-masked]>
---
 arch/powerpc/platforms/powernv/npu-dma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
index 68bfaef44862..72d3749da02c 100644
--- a/arch/powerpc/platforms/powernv/npu-dma.c
+++ b/arch/powerpc/platforms/powernv/npu-dma.c
@@ -21,11 +21,11 @@
 
 static struct pci_dev *get_pci_dev(struct device_node *dn)
 {
-	struct pci_dn *pdn = PCI_DN(dn);
-	struct pci_dev *pdev;
+	struct pci_dev *pdev = NULL;
 
-	pdev = pci_get_domain_bus_and_slot(pci_domain_nr(pdn->phb->bus),
-					   pdn->busno, pdn->devfn);
+	for_each_pci_dev(pdev)
+		if (pdev->dev.of_node == dn)
+			break;
 
 	/*
 	 * pci_get_domain_bus_and_slot() increased the reference count of
-- 
2.21.0