powerpc: Use of_get_cpu_hwid()
Replace open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20211006164332.1981454-8-robh@kernel.org
This commit is contained in:
parent
4e0fa9eeb1
commit
41408b22ec
@ -1313,18 +1313,13 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
|
|||||||
int cpu_to_core_id(int cpu)
|
int cpu_to_core_id(int cpu)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
const __be32 *reg;
|
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
||||||
np = of_get_cpu_node(cpu, NULL);
|
np = of_get_cpu_node(cpu, NULL);
|
||||||
if (!np)
|
if (!np)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
reg = of_get_property(np, "reg", NULL);
|
id = of_get_cpu_hwid(np, 0);
|
||||||
if (!reg)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
id = be32_to_cpup(reg);
|
|
||||||
out:
|
out:
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
return id;
|
return id;
|
||||||
|
Loading…
Reference in New Issue
Block a user