[PATCH 16/16] Use of_get_next_child() in EEH print_device_node_tree()
Michael Ellerman
michael at ellerman.id.au
Fri Oct 26 16:54:50 EST 2007
We should use of_get_next_child() in print_device_node_tree() to safely
traverse the node's children.
Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
arch/powerpc/platforms/pseries/eeh_driver.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index abf1850..0a23bc4 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -44,6 +44,7 @@ static inline const char * pcid_name (struct pci_dev *pdev)
#ifdef DEBUG
static void print_device_node_tree (struct pci_dn *pdn, int dent)
{
+ struct device_node *pc;
int i;
if (!pdn) return;
for (i=0;i<dent; i++)
@@ -52,11 +53,8 @@ static void print_device_node_tree (struct pci_dn *pdn, int dent)
pdn->node->name, pdn->eeh_mode, pdn->eeh_config_addr,
pdn->eeh_pe_config_addr, pdn->node->full_name);
dent += 3;
- struct device_node *pc = pdn->node->child;
- while (pc) {
+ for (pc = NULL; (pc = of_get_next_child(pdn->node, pc));)
print_device_node_tree(PCI_DN(pc), dent);
- pc = pc->sibling;
- }
}
#endif
--
1.5.2.rc1.1884.g59b20
More information about the Linuxppc-dev
mailing list