aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2008-01-02 23:13:37 -0500
committerPaul Mackerras <paulus@samba.org>2008-01-16 22:57:20 -0500
commit85e99b9fffb62e101e38c74c935256fc589703c2 (patch)
tree60e27e43527332ac21be5c1c0ee95f11a61d6cf1 /arch/powerpc
parente25c47ffa97ca5e4602593b03ce6d21cff652864 (diff)
[POWERPC] arch/powerpc/kernel: Use for_each_child_of_node
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/ibmebus.c2
-rw-r--r--arch/powerpc/kernel/of_platform.c4
-rw-r--r--arch/powerpc/kernel/pci_32.c4
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/kernel/rtas_pci.c5
5 files changed, 8 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 3b708449f731..fd5ae8d17c96 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -172,7 +172,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
172 172
173 root = of_find_node_by_path("/"); 173 root = of_find_node_by_path("/");
174 174
175 for (child = NULL; (child = of_get_next_child(root, child)); ) { 175 for_each_child_of_node(root, child) {
176 if (!of_match_node(matches, child)) 176 if (!of_match_node(matches, child))
177 continue; 177 continue;
178 178
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 7a3cafbe8af9..fb698d47082d 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -109,7 +109,7 @@ static int of_platform_bus_create(const struct device_node *bus,
109 struct of_device *dev; 109 struct of_device *dev;
110 int rc = 0; 110 int rc = 0;
111 111
112 for (child = NULL; (child = of_get_next_child(bus, child)); ) { 112 for_each_child_of_node(bus, child) {
113 pr_debug(" create child: %s\n", child->full_name); 113 pr_debug(" create child: %s\n", child->full_name);
114 dev = of_platform_device_create(child, NULL, parent); 114 dev = of_platform_device_create(child, NULL, parent);
115 if (dev == NULL) 115 if (dev == NULL)
@@ -171,7 +171,7 @@ int of_platform_bus_probe(struct device_node *root,
171 rc = of_platform_bus_create(root, matches, &dev->dev); 171 rc = of_platform_bus_create(root, matches, &dev->dev);
172 goto bail; 172 goto bail;
173 } 173 }
174 for (child = NULL; (child = of_get_next_child(root, child)); ) { 174 for_each_child_of_node(root, child) {
175 if (!of_match_node(matches, child)) 175 if (!of_match_node(matches, child))
176 continue; 176 continue;
177 177
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 47dc754465bb..14e300f85ce4 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -276,11 +276,11 @@ scan_OF_pci_childs(struct device_node *parent, pci_OF_scan_iterator filter, void
276static struct device_node *scan_OF_for_pci_dev(struct device_node *parent, 276static struct device_node *scan_OF_for_pci_dev(struct device_node *parent,
277 unsigned int devfn) 277 unsigned int devfn)
278{ 278{
279 struct device_node *np = NULL; 279 struct device_node *np;
280 const u32 *reg; 280 const u32 *reg;
281 unsigned int psize; 281 unsigned int psize;
282 282
283 while ((np = of_get_next_child(parent, np)) != NULL) { 283 for_each_child_of_node(parent, np) {
284 reg = of_get_property(np, "reg", &psize); 284 reg = of_get_property(np, "reg", &psize);
285 if (reg == NULL || psize < 4) 285 if (reg == NULL || psize < 4)
286 continue; 286 continue;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 5949bbabd7fb..1930f393d01c 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -227,7 +227,7 @@ EXPORT_SYMBOL(of_create_pci_dev);
227void __devinit of_scan_bus(struct device_node *node, 227void __devinit of_scan_bus(struct device_node *node,
228 struct pci_bus *bus) 228 struct pci_bus *bus)
229{ 229{
230 struct device_node *child = NULL; 230 struct device_node *child;
231 const u32 *reg; 231 const u32 *reg;
232 int reglen, devfn; 232 int reglen, devfn;
233 struct pci_dev *dev; 233 struct pci_dev *dev;
@@ -235,7 +235,7 @@ void __devinit of_scan_bus(struct device_node *node,
235 DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number); 235 DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number);
236 236
237 /* Scan direct children */ 237 /* Scan direct children */
238 while ((child = of_get_next_child(node, child)) != NULL) { 238 for_each_child_of_node(node, child) {
239 DBG(" * %s\n", child->full_name); 239 DBG(" * %s\n", child->full_name);
240 reg = of_get_property(child, "reg", &reglen); 240 reg = of_get_property(child, "reg", &reglen);
241 if (reg == NULL || reglen < 20) 241 if (reg == NULL || reglen < 20)
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 99aaae3409c0..433a0a0949fb 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -280,10 +280,7 @@ void __init find_and_init_phbs(void)
280 struct pci_controller *phb; 280 struct pci_controller *phb;
281 struct device_node *root = of_find_node_by_path("/"); 281 struct device_node *root = of_find_node_by_path("/");
282 282
283 for (node = of_get_next_child(root, NULL); 283 for_each_child_of_node(root, node) {
284 node != NULL;
285 node = of_get_next_child(root, node)) {
286
287 if (node->type == NULL || (strcmp(node->type, "pci") != 0 && 284 if (node->type == NULL || (strcmp(node->type, "pci") != 0 &&
288 strcmp(node->type, "pciex") != 0)) 285 strcmp(node->type, "pciex") != 0))
289 continue; 286 continue;