diff options
author | Grant Likely <grant.likely@linaro.org> | 2014-06-04 11:42:26 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-06-26 12:12:24 -0400 |
commit | ccdb8ed3b3c739fe99a6f2f474f7ffad3203485d (patch) | |
tree | f556b308a0fb81e00a39155596fab68374159cc5 /drivers | |
parent | a752ee56ad84bf9a35b8323af1ad22b03c1df2c4 (diff) |
of: Migrate of_find_node_by_name() users to for_each_node_by_name()
There are a bunch of users open coding the for_each_node_by_name() by
calling of_find_node_by_name() directly instead of using the macro. This
is getting in the way of some cleanups, and the possibility of removing
of_find_node_by_name() entirely. Clean it up so that all the users are
consistent.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpufreq/pmac64-cpufreq.c | 3 | ||||
-rw-r--r-- | drivers/edac/cell_edac.c | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_core.c | 4 | ||||
-rw-r--r-- | drivers/tty/serial/pmac_zilog.c | 9 |
4 files changed, 7 insertions, 12 deletions
diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c index 8bc422977b5b..4ff86878727f 100644 --- a/drivers/cpufreq/pmac64-cpufreq.c +++ b/drivers/cpufreq/pmac64-cpufreq.c | |||
@@ -499,8 +499,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpunode) | |||
499 | } | 499 | } |
500 | 500 | ||
501 | /* Lookup the i2c hwclock */ | 501 | /* Lookup the i2c hwclock */ |
502 | for (hwclock = NULL; | 502 | for_each_node_by_name(hwclock, "i2c-hwclock") { |
503 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ | ||
504 | const char *loc = of_get_property(hwclock, | 503 | const char *loc = of_get_property(hwclock, |
505 | "hwctrl-location", NULL); | 504 | "hwctrl-location", NULL); |
506 | if (loc == NULL) | 505 | if (loc == NULL) |
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c index 374b57fc596d..a12c8552f6a6 100644 --- a/drivers/edac/cell_edac.c +++ b/drivers/edac/cell_edac.c | |||
@@ -134,8 +134,7 @@ static void cell_edac_init_csrows(struct mem_ctl_info *mci) | |||
134 | int j; | 134 | int j; |
135 | u32 nr_pages; | 135 | u32 nr_pages; |
136 | 136 | ||
137 | for (np = NULL; | 137 | for_each_node_by_name(np, "memory") { |
138 | (np = of_find_node_by_name(np, "memory")) != NULL;) { | ||
139 | struct resource r; | 138 | struct resource r; |
140 | 139 | ||
141 | /* We "know" that the Cell firmware only creates one entry | 140 | /* We "know" that the Cell firmware only creates one entry |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 93aa29f6d39c..f2945fa73d4f 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -375,11 +375,11 @@ static void __exit cleanup_slots(void) | |||
375 | 375 | ||
376 | static int __init rpaphp_init(void) | 376 | static int __init rpaphp_init(void) |
377 | { | 377 | { |
378 | struct device_node *dn = NULL; | 378 | struct device_node *dn; |
379 | 379 | ||
380 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 380 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
381 | 381 | ||
382 | while ((dn = of_find_node_by_name(dn, "pci"))) | 382 | for_each_node_by_name(dn, "pci") |
383 | rpaphp_add_slot(dn); | 383 | rpaphp_add_slot(dn); |
384 | 384 | ||
385 | return 0; | 385 | return 0; |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 8193635103ee..01e180bc6b5d 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -1650,8 +1650,7 @@ static int __init pmz_probe(void) | |||
1650 | /* | 1650 | /* |
1651 | * Find all escc chips in the system | 1651 | * Find all escc chips in the system |
1652 | */ | 1652 | */ |
1653 | node_p = of_find_node_by_name(NULL, "escc"); | 1653 | for_each_node_by_name(node_p, "escc") { |
1654 | while (node_p) { | ||
1655 | /* | 1654 | /* |
1656 | * First get channel A/B node pointers | 1655 | * First get channel A/B node pointers |
1657 | * | 1656 | * |
@@ -1669,7 +1668,7 @@ static int __init pmz_probe(void) | |||
1669 | of_node_put(node_b); | 1668 | of_node_put(node_b); |
1670 | printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n", | 1669 | printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n", |
1671 | (!node_a) ? 'a' : 'b', node_p->full_name); | 1670 | (!node_a) ? 'a' : 'b', node_p->full_name); |
1672 | goto next; | 1671 | continue; |
1673 | } | 1672 | } |
1674 | 1673 | ||
1675 | /* | 1674 | /* |
@@ -1696,11 +1695,9 @@ static int __init pmz_probe(void) | |||
1696 | of_node_put(node_b); | 1695 | of_node_put(node_b); |
1697 | memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port)); | 1696 | memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port)); |
1698 | memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port)); | 1697 | memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port)); |
1699 | goto next; | 1698 | continue; |
1700 | } | 1699 | } |
1701 | count += 2; | 1700 | count += 2; |
1702 | next: | ||
1703 | node_p = of_find_node_by_name(node_p, "escc"); | ||
1704 | } | 1701 | } |
1705 | pmz_ports_count = count; | 1702 | pmz_ports_count = count; |
1706 | 1703 | ||