[Very RFC 33/46] powernv/pci: Remove open-coded PE lookup in iommu notifier
Alexey Kardashevskiy
aik at ozlabs.ru
Wed Nov 27 16:09:41 AEDT 2019
On 20/11/2019 12:28, Oliver O'Halloran wrote:
> 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;
This check is weird - the function does not use @phb anymore, it would
make more sense if pnv_ioda_get_pe() checked phb!=NULL.
>
> - 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:
>
--
Alexey
More information about the Linuxppc-dev
mailing list