c6x: use for_each_of_cpu_node iterator
authorRob Herring <robh@kernel.org>
Mon, 27 Aug 2018 12:53:30 +0000 (07:53 -0500)
committerRob Herring <robh@kernel.org>
Fri, 28 Sep 2018 19:25:58 +0000 (14:25 -0500)
Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
has the side effect of defaulting to iterating using "cpu" node names
in preference to the deprecated (for FDT) device_type == "cpu".

Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
Cc: linux-c6x-dev@linux-c6x.org
Signed-off-by: Rob Herring <robh@kernel.org>
arch/c6x/kernel/setup.c

index 786e36e2f61de91c8f446cc941cff895cdb91578..2e97455ca0b7b0cf857291a1b1957ab1d9c6cecf 100644 (file)
@@ -96,7 +96,7 @@ static void __init get_cpuinfo(void)
        unsigned long core_khz;
        u64 tmp;
        struct cpuinfo_c6x *p;
-       struct device_node *node, *np;
+       struct device_node *node;
 
        p = &per_cpu(cpu_data, smp_processor_id());
 
@@ -190,13 +190,8 @@ static void __init get_cpuinfo(void)
 
        p->core_id = get_coreid();
 
-       node = of_find_node_by_name(NULL, "cpus");
-       if (node) {
-               for_each_child_of_node(node, np)
-                       if (!strcmp("cpu", np->name))
-                               ++c6x_num_cores;
-               of_node_put(node);
-       }
+       for_each_of_cpu_node(node)
+               ++c6x_num_cores;
 
        node = of_find_node_by_name(NULL, "soc");
        if (node) {