Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 902bdc57 authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Michael Ellerman
Browse files

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: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: default avatarRussell Currey <ruscur@russell.cc>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 5c8136fa
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -197,8 +197,6 @@ struct pci_dn {
	struct	iommu_table_group *table_group;	/* for phb's or bridges */
	struct	iommu_table_group *table_group;	/* for phb's or bridges */


	int	pci_ext_config_space;	/* for pci devices */
	int	pci_ext_config_space;	/* for pci devices */

	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
#ifdef CONFIG_EEH
#ifdef CONFIG_EEH
	struct eeh_dev *edev;		/* eeh device */
	struct eeh_dev *edev;		/* eeh device */
#endif
#endif
+4 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,10 @@
 */
 */
static struct pci_dev *get_pci_dev(struct device_node *dn)
static struct pci_dev *get_pci_dev(struct device_node *dn)
{
{
	return PCI_DN(dn)->pcidev;
	struct pci_dn *pdn = PCI_DN(dn);

	return pci_get_domain_bus_and_slot(pci_domain_nr(pdn->phb->bus),
					   pdn->busno, pdn->devfn);
}
}


/* Given a NPU device get the associated PCI device. */
/* Given a NPU device get the associated PCI device. */
+0 −3
Original line number Original line Diff line number Diff line
@@ -1082,7 +1082,6 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
	 * At some point we want to remove the PDN completely anyways
	 * At some point we want to remove the PDN completely anyways
	 */
	 */
	pci_dev_get(dev);
	pci_dev_get(dev);
	pdn->pcidev = dev;
	pdn->pe_number = pe->pe_number;
	pdn->pe_number = pe->pe_number;
	pe->flags = PNV_IODA_PE_DEV;
	pe->flags = PNV_IODA_PE_DEV;
	pe->pdev = dev;
	pe->pdev = dev;
@@ -1129,7 +1128,6 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
			continue;
			continue;


		pe->device_count++;
		pe->device_count++;
		pdn->pcidev = dev;
		pdn->pe_number = pe->pe_number;
		pdn->pe_number = pe->pe_number;
		if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
		if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
			pnv_ioda_setup_same_PE(dev->subordinate, pe);
			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)
			pci_dev_get(npu_pdev);
			pci_dev_get(npu_pdev);
			npu_pdn = pci_get_pdn(npu_pdev);
			npu_pdn = pci_get_pdn(npu_pdev);
			rid = npu_pdev->bus->number << 8 | npu_pdn->devfn;
			rid = npu_pdev->bus->number << 8 | npu_pdn->devfn;
			npu_pdn->pcidev = npu_pdev;
			npu_pdn->pe_number = pe_num;
			npu_pdn->pe_number = pe_num;
			phb->ioda.pe_rmap[rid] = pe->pe_number;
			phb->ioda.pe_rmap[rid] = pe->pe_number;