aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-06-04 11:42:26 -0400
committerGrant Likely <grant.likely@linaro.org>2014-06-26 12:12:24 -0400
commitccdb8ed3b3c739fe99a6f2f474f7ffad3203485d (patch)
treef556b308a0fb81e00a39155596fab68374159cc5 /arch
parenta752ee56ad84bf9a35b8323af1ad22b03c1df2c4 (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 'arch')
-rw-r--r--arch/powerpc/platforms/powermac/feature.c20
-rw-r--r--arch/powerpc/platforms/powermac/pci.c2
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/powermac/udbg_adb.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c3
5 files changed, 9 insertions, 20 deletions
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 63d82bbc05e9..39e1d163c427 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -2805,25 +2805,20 @@ set_initial_features(void)
2805 /* Enable GMAC for now for PCI probing. It will be disabled 2805 /* Enable GMAC for now for PCI probing. It will be disabled
2806 * later on after PCI probe 2806 * later on after PCI probe
2807 */ 2807 */
2808 np = of_find_node_by_name(NULL, "ethernet"); 2808 for_each_node_by_name(np, "ethernet")
2809 while(np) {
2810 if (of_device_is_compatible(np, "K2-GMAC")) 2809 if (of_device_is_compatible(np, "K2-GMAC"))
2811 g5_gmac_enable(np, 0, 1); 2810 g5_gmac_enable(np, 0, 1);
2812 np = of_find_node_by_name(np, "ethernet");
2813 }
2814 2811
2815 /* Enable FW before PCI probe. Will be disabled later on 2812 /* Enable FW before PCI probe. Will be disabled later on
2816 * Note: We should have a batter way to check that we are 2813 * Note: We should have a batter way to check that we are
2817 * dealing with uninorth internal cell and not a PCI cell 2814 * dealing with uninorth internal cell and not a PCI cell
2818 * on the external PCI. The code below works though. 2815 * on the external PCI. The code below works though.
2819 */ 2816 */
2820 np = of_find_node_by_name(NULL, "firewire"); 2817 for_each_node_by_name(np, "firewire") {
2821 while(np) {
2822 if (of_device_is_compatible(np, "pci106b,5811")) { 2818 if (of_device_is_compatible(np, "pci106b,5811")) {
2823 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED; 2819 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2824 g5_fw_enable(np, 0, 1); 2820 g5_fw_enable(np, 0, 1);
2825 } 2821 }
2826 np = of_find_node_by_name(np, "firewire");
2827 } 2822 }
2828 } 2823 }
2829#else /* CONFIG_POWER4 */ 2824#else /* CONFIG_POWER4 */
@@ -2834,13 +2829,11 @@ set_initial_features(void)
2834 /* Enable GMAC for now for PCI probing. It will be disabled 2829 /* Enable GMAC for now for PCI probing. It will be disabled
2835 * later on after PCI probe 2830 * later on after PCI probe
2836 */ 2831 */
2837 np = of_find_node_by_name(NULL, "ethernet"); 2832 for_each_node_by_name(np, "ethernet") {
2838 while(np) {
2839 if (np->parent 2833 if (np->parent
2840 && of_device_is_compatible(np->parent, "uni-north") 2834 && of_device_is_compatible(np->parent, "uni-north")
2841 && of_device_is_compatible(np, "gmac")) 2835 && of_device_is_compatible(np, "gmac"))
2842 core99_gmac_enable(np, 0, 1); 2836 core99_gmac_enable(np, 0, 1);
2843 np = of_find_node_by_name(np, "ethernet");
2844 } 2837 }
2845 2838
2846 /* Enable FW before PCI probe. Will be disabled later on 2839 /* Enable FW before PCI probe. Will be disabled later on
@@ -2848,8 +2841,7 @@ set_initial_features(void)
2848 * dealing with uninorth internal cell and not a PCI cell 2841 * dealing with uninorth internal cell and not a PCI cell
2849 * on the external PCI. The code below works though. 2842 * on the external PCI. The code below works though.
2850 */ 2843 */
2851 np = of_find_node_by_name(NULL, "firewire"); 2844 for_each_node_by_name(np, "firewire") {
2852 while(np) {
2853 if (np->parent 2845 if (np->parent
2854 && of_device_is_compatible(np->parent, "uni-north") 2846 && of_device_is_compatible(np->parent, "uni-north")
2855 && (of_device_is_compatible(np, "pci106b,18") || 2847 && (of_device_is_compatible(np, "pci106b,18") ||
@@ -2858,18 +2850,16 @@ set_initial_features(void)
2858 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED; 2850 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2859 core99_firewire_enable(np, 0, 1); 2851 core99_firewire_enable(np, 0, 1);
2860 } 2852 }
2861 np = of_find_node_by_name(np, "firewire");
2862 } 2853 }
2863 2854
2864 /* Enable ATA-100 before PCI probe. */ 2855 /* Enable ATA-100 before PCI probe. */
2865 np = of_find_node_by_name(NULL, "ata-6"); 2856 np = of_find_node_by_name(NULL, "ata-6");
2866 while(np) { 2857 for_each_node_by_name(np, "ata-6") {
2867 if (np->parent 2858 if (np->parent
2868 && of_device_is_compatible(np->parent, "uni-north") 2859 && of_device_is_compatible(np->parent, "uni-north")
2869 && of_device_is_compatible(np, "kauai-ata")) { 2860 && of_device_is_compatible(np, "kauai-ata")) {
2870 core99_ata100_enable(np, 1); 2861 core99_ata100_enable(np, 1);
2871 } 2862 }
2872 np = of_find_node_by_name(np, "ata-6");
2873 } 2863 }
2874 2864
2875 /* Switch airport off */ 2865 /* Switch airport off */
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index cf7009b8c7b6..7e868ccf3b0d 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -698,7 +698,7 @@ static void __init fixup_nec_usb2(void)
698{ 698{
699 struct device_node *nec; 699 struct device_node *nec;
700 700
701 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { 701 for_each_node_by_name(nec, "usb") {
702 struct pci_controller *hose; 702 struct pci_controller *hose;
703 u32 data; 703 u32 data;
704 const u32 *prop; 704 const u32 *prop;
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 5cbd4d67d5c4..af094ae03dbb 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -577,7 +577,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
577 int ok; 577 int ok;
578 578
579 /* Look for the clock chip */ 579 /* Look for the clock chip */
580 while ((cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL) { 580 for_each_node_by_name(cc, "i2c-hwclock") {
581 p = of_get_parent(cc); 581 p = of_get_parent(cc);
582 ok = p && of_device_is_compatible(p, "uni-n-i2c"); 582 ok = p && of_device_is_compatible(p, "uni-n-i2c");
583 of_node_put(p); 583 of_node_put(p);
diff --git a/arch/powerpc/platforms/powermac/udbg_adb.c b/arch/powerpc/platforms/powermac/udbg_adb.c
index 44e0b55a2a02..366bd221edec 100644
--- a/arch/powerpc/platforms/powermac/udbg_adb.c
+++ b/arch/powerpc/platforms/powermac/udbg_adb.c
@@ -191,7 +191,7 @@ int __init udbg_adb_init(int force_btext)
191 * of type "adb". If not, we return a failure, but we keep the 191 * of type "adb". If not, we return a failure, but we keep the
192 * bext output set for now 192 * bext output set for now
193 */ 193 */
194 for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) { 194 for_each_node_by_name(np, "keyboard") {
195 struct device_node *parent = of_get_parent(np); 195 struct device_node *parent = of_get_parent(np);
196 int found = (parent && strcmp(parent->type, "adb") == 0); 196 int found = (parent && strcmp(parent->type, "adb") == 0);
197 of_node_put(parent); 197 of_node_put(parent);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f2f40e64658f..cd6b4cde0de3 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -232,8 +232,7 @@ static void __init pseries_discover_pic(void)
232 struct device_node *np; 232 struct device_node *np;
233 const char *typep; 233 const char *typep;
234 234
235 for (np = NULL; (np = of_find_node_by_name(np, 235 for_each_node_by_name(np, "interrupt-controller") {
236 "interrupt-controller"));) {
237 typep = of_get_property(np, "compatible", NULL); 236 typep = of_get_property(np, "compatible", NULL);
238 if (strstr(typep, "open-pic")) { 237 if (strstr(typep, "open-pic")) {
239 pSeries_mpic_node = of_node_get(np); 238 pSeries_mpic_node = of_node_get(np);