> +#ifdef CONFIG_PCI_IOV > + struct pnv_ioda_pe *pe; > + > + /* Fix the VF pdn PE number */ > + if (pdev->is_virtfn) { > + list_for_each_entry(pe, &phb->ioda.pe_list, list) { > + if (pe->rid == ((pdev->bus->number << 8) | > + (pdev->devfn & 0xff))) { > + pe->pdev = pdev; > + break; > + } > + } > + } > +#endif /* CONFIG_PCI_IOV */
It would be nice to split this into a helper. And I think using IS_ENABLED we might not even need ifdefs: static void pnv_pci_dma_fixup_vfs(struct pci_dev *pdev) { struct pnv_ioda_pe *pe; list_for_each_entry(pe, &phb->ioda.pe_list, list) { if (pe->rid == ((pdev->bus->number << 8) | (pdev->devfn & 0xff))) { pe->pdev = pdev; break; } } ... if (IS_ENABLED(CONFIG_PCI_IOV) && pdev->is_virtfn) pnv_pci_dma_fixup_vfs(pdev);