提交 ea0f8acf 编写于 作者: G Gavin Shan 提交者: Michael Ellerman

powerpc/pseries: Cleanup on pci_dn_reconfig_notifier()

This applies cleanup on pci_dn_reconfig_notifier(), no functional
changes:

   * Rename variable "pci" to "pdn" to indicate its purpose clearly.
   * The parent node can be released at any time. So it should be
     hold with of_get_parent() before accessing it.
   * The device node doesn't have to have parent node in theory.
     More check on this.
Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 590c7567
...@@ -254,24 +254,26 @@ static void __init pseries_discover_pic(void) ...@@ -254,24 +254,26 @@ static void __init pseries_discover_pic(void)
static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data) static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data)
{ {
struct of_reconfig_data *rd = data; struct of_reconfig_data *rd = data;
struct device_node *np = rd->dn; struct device_node *parent, *np = rd->dn;
struct pci_dn *pci = NULL; struct pci_dn *pdn;
int err = NOTIFY_OK; int err = NOTIFY_OK;
switch (action) { switch (action) {
case OF_RECONFIG_ATTACH_NODE: case OF_RECONFIG_ATTACH_NODE:
pci = np->parent->data; parent = of_get_parent(np);
if (pci) { pdn = parent ? PCI_DN(parent) : NULL;
update_dn_pci_info(np, pci->phb); if (pdn) {
/* Create pdn and EEH device */
/* Create EEH device for the OF node */ update_dn_pci_info(np, pdn->phb);
eeh_dev_init(PCI_DN(np), pci->phb); eeh_dev_init(PCI_DN(np), pdn->phb);
} }
of_node_put(parent);
break; break;
case OF_RECONFIG_DETACH_NODE: case OF_RECONFIG_DETACH_NODE:
pci = PCI_DN(np); pdn = PCI_DN(np);
if (pci) if (pdn)
list_del(&pci->list); list_del(&pdn->list);
break; break;
default: default:
err = NOTIFY_DONE; err = NOTIFY_DONE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册