nios2: get cpu node with of_get_cpu_node
authorRob Herring <robh@kernel.org>
Mon, 27 Aug 2018 18:27:25 +0000 (13:27 -0500)
committerRob Herring <robh@kernel.org>
Fri, 28 Sep 2018 19:25:58 +0000 (14:25 -0500)
"device_type" use is deprecated for FDT though it has continued to be used
for nodes like cpu nodes. Use of_get_cpu_node() instead which works using
node names by default. This will allow the eventually removal of cpu
device_type properties.

Also, fix a leaked reference by adding a missing of_node_put.

Cc: Ley Foon Tan <lftan@altera.com>
Cc: nios2-dev@lists.rocketboards.org
Signed-off-by: Rob Herring <robh@kernel.org>
arch/nios2/kernel/cpuinfo.c

index 93207718bb221067e32eb77a164464b75cff5d7f..ccc1d2a15a0a0320574be8ac7f0e7a6acd2b28fa 100644 (file)
@@ -47,7 +47,7 @@ void __init setup_cpuinfo(void)
        const char *str;
        int len;
 
-       cpu = of_find_node_by_type(NULL, "cpu");
+       cpu = of_get_cpu_node(0, NULL);
        if (!cpu)
                panic("%s: No CPU found in devicetree!\n", __func__);
 
@@ -120,6 +120,8 @@ void __init setup_cpuinfo(void)
        cpuinfo.reset_addr = fcpu(cpu, "altr,reset-addr");
        cpuinfo.exception_addr = fcpu(cpu, "altr,exception-addr");
        cpuinfo.fast_tlb_miss_exc_addr = fcpu(cpu, "altr,fast-tlb-miss-addr");
+
+       of_node_put(cpu);
 }
 
 #ifdef CONFIG_PROC_FS