powerpc/powernv: Use pci_dn, not device_node, in PCI config accessor
authorGavin Shan <gwshan@linux.vnet.ibm.com>
Tue, 17 Mar 2015 05:15:03 +0000 (16:15 +1100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 24 Mar 2015 02:15:50 +0000 (13:15 +1100)
The PCI config accessors previously relied on device_node.  Unfortunately,
VFs don't have a corresponding device_node, so change the accessors to use
pci_dn instead.

[bhelgaas: changelog]
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/powernv/eeh-powernv.c
arch/powerpc/platforms/powernv/pci.c
arch/powerpc/platforms/powernv/pci.h

index ede6906..8eac8c5 100644 (file)
@@ -1038,21 +1038,31 @@ static inline bool pnv_eeh_cfg_blocked(struct device_node *dn)
 static int pnv_eeh_read_config(struct device_node *dn,
                               int where, int size, u32 *val)
 {
+       struct pci_dn *pdn = PCI_DN(dn);
+
+       if (!pdn)
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
        if (pnv_eeh_cfg_blocked(dn)) {
                *val = 0xFFFFFFFF;
                return PCIBIOS_SET_FAILED;
        }
 
-       return pnv_pci_cfg_read(dn, where, size, val);
+       return pnv_pci_cfg_read(pdn, where, size, val);
 }
 
 static int pnv_eeh_write_config(struct device_node *dn,
                                int where, int size, u32 val)
 {
+       struct pci_dn *pdn = PCI_DN(dn);
+
+       if (!pdn)
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
        if (pnv_eeh_cfg_blocked(dn))
                return PCIBIOS_SET_FAILED;
 
-       return pnv_pci_cfg_write(dn, where, size, val);
+       return pnv_pci_cfg_write(pdn, where, size, val);
 }
 
 static void pnv_eeh_dump_hub_diag_common(struct OpalIoP7IOCErrorData *data)
Simple merge
Simple merge