Re: [RFC 1/3] of: Migrate of_find_node_by_name() users to for_each_node_by_name()
From: Rob Herring <hidden>
Date: 2014-06-26 19:00:05
On Thu, Jun 26, 2014 at 1:56 PM, Grant Likely [off-list ref] wrote:
On Thu, Jun 26, 2014 at 7:22 PM, Rob Herring [off-list ref] wrote:quoted
On Thu, Jun 26, 2014 at 11:03 AM, Grant Likely [off-list ref] wrote:quoted
On Thu, 5 Jun 2014 12:48:54 -0500, Rob Herring [off-list ref] wrote:quoted
On Thu, Jun 5, 2014 at 10:43 AM, Grant Likely [off-list ref] wrote:quoted
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 <redacted> --- arch/powerpc/platforms/powermac/feature.c | 20 +++++--------------- arch/powerpc/platforms/powermac/pci.c | 2 +- arch/powerpc/platforms/powermac/smp.c | 2 +- arch/powerpc/platforms/powermac/udbg_adb.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 3 +-- drivers/cpufreq/pmac64-cpufreq.c | 3 +-- drivers/edac/cell_edac.c | 3 +-- drivers/pci/hotplug/rpaphp_core.c | 4 ++-- drivers/tty/serial/pmac_zilog.c | 9 +++------ sound/ppc/pmac.c | 6 +++--- 10 files changed, 19 insertions(+), 35 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) /* Enable GMAC for now for PCI probing. It will be disabled * later on after PCI probe */ - np = of_find_node_by_name(NULL, "ethernet"); - while(np) { + for_each_node_by_name(np, "ethernet") if (of_device_is_compatible(np, "K2-GMAC"))Can't for_each_compatible_node be used here instead?Not easily without changing the behaviour. It would need to then check the name inside the block.Why would it change behavior? If the compatible string matches, do you really have cases where the node name is not "ethernet"? I don't believe it's the kernel's job to validate DT bindings.Yes, there are actually some bindings that have the same compatible property but behaviour changes based on node name! I don't want to do the legwork to figure out if these are in that group. Someone else can do that job.
Well, that's just wrong. Rob -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html