Commit 0aa8ff9b authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Michael Ellerman

powerpc: Use of for_each_node_by_name() instead of open-coding it

Instead of manually coding the loop with of_find_node_by_name(), let's
switch to the standard macro for iterating over nodes with given name.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
[mpe: Fix build failures due to typo in mpc832x_mds.c]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent df262002
...@@ -75,7 +75,7 @@ static void __init mpc832x_sys_setup_arch(void) ...@@ -75,7 +75,7 @@ static void __init mpc832x_sys_setup_arch(void)
par_io_init(np); par_io_init(np);
of_node_put(np); of_node_put(np);
for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) for_each_node_by_name(np, "ucc")
par_io_of_config(np); par_io_of_config(np);
} }
......
...@@ -204,7 +204,7 @@ static void __init mpc832x_rdb_setup_arch(void) ...@@ -204,7 +204,7 @@ static void __init mpc832x_rdb_setup_arch(void)
par_io_init(np); par_io_init(np);
of_node_put(np); of_node_put(np);
for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) for_each_node_by_name(np, "ucc")
par_io_of_config(np); par_io_of_config(np);
} }
#endif /* CONFIG_QUICC_ENGINE */ #endif /* CONFIG_QUICC_ENGINE */
......
...@@ -83,7 +83,7 @@ static void __init mpc836x_mds_setup_arch(void) ...@@ -83,7 +83,7 @@ static void __init mpc836x_mds_setup_arch(void)
par_io_init(np); par_io_init(np);
of_node_put(np); of_node_put(np);
for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) for_each_node_by_name(np, "ucc")
par_io_of_config(np); par_io_of_config(np);
#ifdef CONFIG_QE_USB #ifdef CONFIG_QE_USB
/* Must fixup Par IO before QE GPIO chips are registered. */ /* Must fixup Par IO before QE GPIO chips are registered. */
......
...@@ -315,8 +315,7 @@ static int __init setup_iic(void) ...@@ -315,8 +315,7 @@ static int __init setup_iic(void)
struct cbe_iic_regs __iomem *node_iic; struct cbe_iic_regs __iomem *node_iic;
const u32 *np; const u32 *np;
for (dn = NULL; for_each_node_by_name(dn, "interrupt-controller") {
(dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) {
if (!of_device_is_compatible(dn, if (!of_device_is_compatible(dn,
"IBM,CBEA-Internal-Interrupt-Controller")) "IBM,CBEA-Internal-Interrupt-Controller"))
continue; continue;
......
...@@ -192,8 +192,7 @@ static void __init mpic_init_IRQ(void) ...@@ -192,8 +192,7 @@ static void __init mpic_init_IRQ(void)
struct device_node *dn; struct device_node *dn;
struct mpic *mpic; struct mpic *mpic;
for (dn = NULL; for_each_node_by_name(dn, "interrupt-controller") {
(dn = of_find_node_by_name(dn, "interrupt-controller"));) {
if (!of_device_is_compatible(dn, "CBEA,platform-open-pic")) if (!of_device_is_compatible(dn, "CBEA,platform-open-pic"))
continue; continue;
......
...@@ -343,8 +343,7 @@ void __init spider_init_IRQ(void) ...@@ -343,8 +343,7 @@ void __init spider_init_IRQ(void)
* device-tree is bogus anyway) so all we can do is pray or maybe test * device-tree is bogus anyway) so all we can do is pray or maybe test
* the address and deduce the node-id * the address and deduce the node-id
*/ */
for (dn = NULL; for_each_node_by_name(dn, "interrupt-controller") {
(dn = of_find_node_by_name(dn, "interrupt-controller"));) {
if (of_device_is_compatible(dn, "CBEA,platform-spider-pic")) { if (of_device_is_compatible(dn, "CBEA,platform-spider-pic")) {
if (of_address_to_resource(dn, 0, &r)) { if (of_address_to_resource(dn, 0, &r)) {
printk(KERN_WARNING "spider-pic: Failed\n"); printk(KERN_WARNING "spider-pic: Failed\n");
......
...@@ -2641,7 +2641,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ ...@@ -2641,7 +2641,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
phys_addr_t addr; phys_addr_t addr;
u64 size; u64 size;
for (node = NULL; (node = of_find_node_by_name(node, name)) != NULL;) { for_each_node_by_name(node, name) {
if (!compat) if (!compat)
break; break;
if (of_device_is_compatible(node, compat)) if (of_device_is_compatible(node, compat))
......
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