openrisc: use for_each_of_cpu_node iterator
authorRob Herring <robh@kernel.org>
Mon, 27 Aug 2018 17:21:39 +0000 (12:21 -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".

This also fixes a leaked reference for cpus node.

Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: openrisc@lists.librecores.org
Acked-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
arch/openrisc/kernel/setup.c

index 9d28ab14d139cb4b6ed842f7f56c444858e17dc0..e17fcd83120f6fadc97a149136f4a22b4d02113f 100644 (file)
@@ -158,9 +158,8 @@ static struct device_node *setup_find_cpu_node(int cpu)
 {
        u32 hwid;
        struct device_node *cpun;
-       struct device_node *cpus = of_find_node_by_path("/cpus");
 
-       for_each_available_child_of_node(cpus, cpun) {
+       for_each_of_cpu_node(cpun) {
                if (of_property_read_u32(cpun, "reg", &hwid))
                        continue;
                if (hwid == cpu)