Commit f1e08232 authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Michael Ellerman

powerpc/pci: Remove OF node back pointer from pci_dn

The check_req() helper uses pci_get_pdn() to get an OF node pointer.
pci_get_pdn() returns a pci_dn pointer which either:
1) from the OF node returned by pci_device_to_OF_node();
2) from the parent child_list where entries don't have OF node pointers.
Since check_req() does not care about 2), it can call
pci_device_to_OF_node() directly, hence the change.

The find_pe_dn() helper uses embedded pci_dn to get an OF node which is
also stored in edev->pdev so let's take a shortcut and call
pci_device_to_OF_node() directly.

With these 2 changes, we can finally get rid of the OF node back pointer.
Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 14db3d52
...@@ -195,7 +195,6 @@ struct pci_dn { ...@@ -195,7 +195,6 @@ struct pci_dn {
struct pci_dn *parent; struct pci_dn *parent;
struct pci_controller *phb; /* for pci devices */ struct pci_controller *phb; /* for pci devices */
struct iommu_table_group *table_group; /* for phb's or bridges */ struct iommu_table_group *table_group; /* for phb's or bridges */
struct device_node *node; /* back-pointer to the device_node */
int pci_ext_config_space; /* for pci devices */ int pci_ext_config_space; /* for pci devices */
......
...@@ -293,7 +293,6 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, ...@@ -293,7 +293,6 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,
if (pdn == NULL) if (pdn == NULL)
return NULL; return NULL;
dn->data = pdn; dn->data = pdn;
pdn->node = dn;
pdn->phb = hose; pdn->phb = hose;
#ifdef CONFIG_PPC_POWERNV #ifdef CONFIG_PPC_POWERNV
pdn->pe_number = IODA_INVALID_PE; pdn->pe_number = IODA_INVALID_PE;
......
...@@ -132,15 +132,10 @@ static void rtas_teardown_msi_irqs(struct pci_dev *pdev) ...@@ -132,15 +132,10 @@ static void rtas_teardown_msi_irqs(struct pci_dev *pdev)
static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
{ {
struct device_node *dn; struct device_node *dn;
struct pci_dn *pdn;
const __be32 *p; const __be32 *p;
u32 req_msi; u32 req_msi;
pdn = pci_get_pdn(pdev); dn = pci_device_to_OF_node(pdev);
if (!pdn)
return -ENODEV;
dn = pdn->node;
p = of_get_property(dn, prop_name, NULL); p = of_get_property(dn, prop_name, NULL);
if (!p) { if (!p) {
...@@ -197,7 +192,6 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) ...@@ -197,7 +192,6 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
{ {
struct device_node *dn; struct device_node *dn;
struct pci_dn *pdn;
struct eeh_dev *edev; struct eeh_dev *edev;
/* Found our PE and assume 8 at that point. */ /* Found our PE and assume 8 at that point. */
...@@ -210,8 +204,7 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) ...@@ -210,8 +204,7 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
edev = pdn_to_eeh_dev(PCI_DN(dn)); edev = pdn_to_eeh_dev(PCI_DN(dn));
if (edev->pe) if (edev->pe)
edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list);
pdn = eeh_dev_to_pdn(edev); dn = pci_device_to_OF_node(edev->pdev);
dn = pdn ? pdn->node : NULL;
if (!dn) if (!dn)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment