diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2017-10-23 04:07:02 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-01-27 04:39:01 -0500 |
commit | 902bdc57451c2c64aa139bbe24067f70a186db0a (patch) | |
tree | ed99d5543498265de270ad04d1fe2ca2dca75561 | |
parent | 5c8136fa1af7c0e9b4aec89cf2832f6e5197ce32 (diff) |
powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
The pcidev value stored in pci_dn is only used for NPU/NPU2
initialization. We can easily drop the cached pointer and
use an ancient helper - pci_get_domain_bus_and_slot() instead in order
to reduce complexity.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/npu-dma.c | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 3 |
3 files changed, 4 insertions, 6 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index b98a44667333..94d449031b18 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -197,8 +197,6 @@ struct pci_dn { | |||
197 | struct iommu_table_group *table_group; /* for phb's or bridges */ | 197 | struct iommu_table_group *table_group; /* for phb's or bridges */ |
198 | 198 | ||
199 | int pci_ext_config_space; /* for pci devices */ | 199 | int pci_ext_config_space; /* for pci devices */ |
200 | |||
201 | struct pci_dev *pcidev; /* back-pointer to the pci device */ | ||
202 | #ifdef CONFIG_EEH | 200 | #ifdef CONFIG_EEH |
203 | struct eeh_dev *edev; /* eeh device */ | 201 | struct eeh_dev *edev; /* eeh device */ |
204 | #endif | 202 | #endif |
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index c5899c107d59..0a253b64ac5f 100644 --- a/arch/powerpc/platforms/powernv/npu-dma.c +++ b/arch/powerpc/platforms/powernv/npu-dma.c | |||
@@ -39,7 +39,10 @@ | |||
39 | */ | 39 | */ |
40 | static struct pci_dev *get_pci_dev(struct device_node *dn) | 40 | static struct pci_dev *get_pci_dev(struct device_node *dn) |
41 | { | 41 | { |
42 | return PCI_DN(dn)->pcidev; | 42 | struct pci_dn *pdn = PCI_DN(dn); |
43 | |||
44 | return pci_get_domain_bus_and_slot(pci_domain_nr(pdn->phb->bus), | ||
45 | pdn->busno, pdn->devfn); | ||
43 | } | 46 | } |
44 | 47 | ||
45 | /* Given a NPU device get the associated PCI device. */ | 48 | /* Given a NPU device get the associated PCI device. */ |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 886014ed85fe..398cc5e4b91b 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1082,7 +1082,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev) | |||
1082 | * At some point we want to remove the PDN completely anyways | 1082 | * At some point we want to remove the PDN completely anyways |
1083 | */ | 1083 | */ |
1084 | pci_dev_get(dev); | 1084 | pci_dev_get(dev); |
1085 | pdn->pcidev = dev; | ||
1086 | pdn->pe_number = pe->pe_number; | 1085 | pdn->pe_number = pe->pe_number; |
1087 | pe->flags = PNV_IODA_PE_DEV; | 1086 | pe->flags = PNV_IODA_PE_DEV; |
1088 | pe->pdev = dev; | 1087 | pe->pdev = dev; |
@@ -1129,7 +1128,6 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) | |||
1129 | continue; | 1128 | continue; |
1130 | 1129 | ||
1131 | pe->device_count++; | 1130 | pe->device_count++; |
1132 | pdn->pcidev = dev; | ||
1133 | pdn->pe_number = pe->pe_number; | 1131 | pdn->pe_number = pe->pe_number; |
1134 | if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) | 1132 | if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) |
1135 | pnv_ioda_setup_same_PE(dev->subordinate, pe); | 1133 | pnv_ioda_setup_same_PE(dev->subordinate, pe); |
@@ -1244,7 +1242,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev) | |||
1244 | pci_dev_get(npu_pdev); | 1242 | pci_dev_get(npu_pdev); |
1245 | npu_pdn = pci_get_pdn(npu_pdev); | 1243 | npu_pdn = pci_get_pdn(npu_pdev); |
1246 | rid = npu_pdev->bus->number << 8 | npu_pdn->devfn; | 1244 | rid = npu_pdev->bus->number << 8 | npu_pdn->devfn; |
1247 | npu_pdn->pcidev = npu_pdev; | ||
1248 | npu_pdn->pe_number = pe_num; | 1245 | npu_pdn->pe_number = pe_num; |
1249 | phb->ioda.pe_rmap[rid] = pe->pe_number; | 1246 | phb->ioda.pe_rmap[rid] = pe->pe_number; |
1250 | 1247 | ||