Thread (21 messages) 21 messages, 4 authors, 2007-11-05

Re: [PATCH 11/16] Use of_get_next_child() in eeh_restore_bars()

From: Michael Ellerman <hidden>
Date: 2007-10-29 03:46:13

On Fri, 2007-10-26 at 17:29 +1000, Stephen Rothwell wrote:
On Fri, 26 Oct 2007 16:54:43 +1000 (EST) Michael Ellerman [off-list ref] wrote:
quoted
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -841,11 +841,8 @@ void eeh_restore_bars(struct pci_dn *pdn)
 	if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code))
 		__restore_bars (pdn);
 
-	dn = pdn->node->child;
-	while (dn) {
+	for (dn = NULL; (dn = of_get_next_child(pdn->node, dn));)
Just wondering if we need

#define for_each_child_node(dn, parent) \
	for (dn = of_get_next_child(parent, NULL); dn; \
		dn = of_get_next_child(parent, dn))
Hmm, perhaps. I count ~30 places we could use it under arch/powerpc, and
about another ~20 in drivers/.

If no one objects, I guess I'll get to it, sigh ... another Yak.

Should we perhaps make it for_each_child_device_node() ?
Otherwise it's slightly non obvious what kind of node it's talking
about, especially in driver code.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help