Commit 14db3d52 authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Michael Ellerman

powerpc/eeh: Reduce use of pci_dn::node

The pci_dn struct caches a OF device node pointer in order to access
the "ibm,loc-code" property when EEH is recovering.

However, when this happens in eeh_dev_check_failure(), we also have
a pci_dev pointer which should have a valid pointer to the device node
when pci_dn has one (both pointers are not NULL for physical functions
and are NULL for virtual functions).

This changes pci_remove_device_node_info() to look for a parent of
the node being removed, just like pci_add_device_node_info() does when it
references the parent node.

This is the first step to get rid of pci_dn::node.
Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 405b33a7
...@@ -435,7 +435,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev) ...@@ -435,7 +435,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
int ret; int ret;
int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE); int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
unsigned long flags; unsigned long flags;
struct pci_dn *pdn; struct device_node *dn;
struct pci_dev *dev; struct pci_dev *dev;
struct eeh_pe *pe, *parent_pe, *phb_pe; struct eeh_pe *pe, *parent_pe, *phb_pe;
int rc = 0; int rc = 0;
...@@ -493,9 +493,10 @@ int eeh_dev_check_failure(struct eeh_dev *edev) ...@@ -493,9 +493,10 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
if (pe->state & EEH_PE_ISOLATED) { if (pe->state & EEH_PE_ISOLATED) {
pe->check_count++; pe->check_count++;
if (pe->check_count % EEH_MAX_FAILS == 0) { if (pe->check_count % EEH_MAX_FAILS == 0) {
pdn = eeh_dev_to_pdn(edev); dn = pci_device_to_OF_node(dev);
if (pdn->node) if (dn)
location = of_get_property(pdn->node, "ibm,loc-code", NULL); location = of_get_property(dn, "ibm,loc-code",
NULL);
printk(KERN_ERR "EEH: %d reads ignored for recovering device at " printk(KERN_ERR "EEH: %d reads ignored for recovering device at "
"location=%s driver=%s pci addr=%s\n", "location=%s driver=%s pci addr=%s\n",
pe->check_count, pe->check_count,
......
...@@ -342,6 +342,7 @@ EXPORT_SYMBOL_GPL(pci_add_device_node_info); ...@@ -342,6 +342,7 @@ EXPORT_SYMBOL_GPL(pci_add_device_node_info);
void pci_remove_device_node_info(struct device_node *dn) void pci_remove_device_node_info(struct device_node *dn)
{ {
struct pci_dn *pdn = dn ? PCI_DN(dn) : NULL; struct pci_dn *pdn = dn ? PCI_DN(dn) : NULL;
struct device_node *parent;
#ifdef CONFIG_EEH #ifdef CONFIG_EEH
struct eeh_dev *edev = pdn_to_eeh_dev(pdn); struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
...@@ -354,8 +355,10 @@ void pci_remove_device_node_info(struct device_node *dn) ...@@ -354,8 +355,10 @@ void pci_remove_device_node_info(struct device_node *dn)
WARN_ON(!list_empty(&pdn->child_list)); WARN_ON(!list_empty(&pdn->child_list));
list_del(&pdn->list); list_del(&pdn->list);
if (pdn->parent)
of_node_put(pdn->parent->node); parent = of_get_parent(dn);
if (parent)
of_node_put(parent);
dn->data = NULL; dn->data = NULL;
kfree(pdn); kfree(pdn);
......
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