[Very RFC 33/46] powernv/pci: Remove open-coded PE lookup in iommu notifier
Oliver O'Halloran
oohall at gmail.com
Wed Nov 20 12:28:46 AEDT 2019
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
arch/powerpc/platforms/powernv/pci.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 5b1f4677cdce..0eeea8652426 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -943,23 +943,22 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
{
struct device *dev = data;
struct pci_dev *pdev;
- struct pci_dn *pdn;
struct pnv_ioda_pe *pe;
struct pnv_phb *phb;
switch (action) {
case BUS_NOTIFY_ADD_DEVICE:
pdev = to_pci_dev(dev);
- pdn = pci_get_pdn(pdev);
phb = pci_bus_to_pnvhb(pdev->bus);
WARN_ON_ONCE(!phb);
- if (!pdn || pdn->pe_number == IODA_INVALID_PE || !phb)
+ if (!phb)
return 0;
- pe = &phb->ioda.pe_array[pdn->pe_number];
- if (!pe->table_group.group)
+ pe = pnv_ioda_get_pe(pdev);
+ if (!pe || !pe->table_group.group)
return 0;
+
iommu_add_device(&pe->table_group, dev);
return 0;
case BUS_NOTIFY_DEL_DEVICE:
--
2.21.0
More information about the Linuxppc-dev
mailing list