Skip to content

Commit 651d44f

Browse files
committed
of: use for_each_of_cpu_node iterator
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: Frank Rowand <frowand.list@gmail.com> Cc: devicetree@vger.kernel.org Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rob Herring <robh@kernel.org>
1 parent a9a455e commit 651d44f

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

drivers/of/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
389389
{
390390
struct device_node *cpun;
391391

392-
for_each_node_by_type(cpun, "cpu") {
392+
for_each_of_cpu_node(cpun) {
393393
if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread))
394394
return cpun;
395395
}

drivers/of/of_numa.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,9 @@ static void __init of_numa_parse_cpu_nodes(void)
2424
{
2525
u32 nid;
2626
int r;
27-
struct device_node *cpus;
28-
struct device_node *np = NULL;
29-
30-
cpus = of_find_node_by_path("/cpus");
31-
if (!cpus)
32-
return;
33-
34-
for_each_child_of_node(cpus, np) {
35-
/* Skip things that are not CPUs */
36-
if (of_node_cmp(np->type, "cpu") != 0)
37-
continue;
27+
struct device_node *np;
3828

29+
for_each_of_cpu_node(np) {
3930
r = of_property_read_u32(np, "numa-node-id", &nid);
4031
if (r)
4132
continue;
@@ -46,8 +37,6 @@ static void __init of_numa_parse_cpu_nodes(void)
4637
else
4738
node_set(nid, numa_nodes_parsed);
4839
}
49-
50-
of_node_put(cpus);
5140
}
5241

5342
static int __init of_numa_parse_memory_nodes(void)

0 commit comments

Comments
 (0)