Skip to content

Commit f86e471

Browse files
author
Sudeep KarkadaNagesha
committed
driver/core: cpu: initialize of_node in cpu's device struture
CPUs are also registered as devices but the of_node in these cpu devices are not initialized. Currently different drivers requiring to access cpu device node are parsing the nodes themselves and initialising the of_node in cpu device. The of_node in all the cpu devices needs to be initialized properly and at one place. The best place to update this is CPU subsystem driver when registering the cpu devices. The OF/DT core library now provides of_get_cpu_node to retrieve a cpu device node for a given logical index by abstracting the architecture specific details. This patch uses of_get_cpu_node to assign of_node when registering the cpu devices. Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Sudeep KarkadaNagesha <[email protected]>
1 parent 973e02c commit f86e471

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/base/cpu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/slab.h>
1515
#include <linux/percpu.h>
1616
#include <linux/acpi.h>
17+
#include <linux/of.h>
1718

1819
#include "base.h"
1920

@@ -289,6 +290,7 @@ int register_cpu(struct cpu *cpu, int num)
289290
cpu->dev.release = cpu_device_release;
290291
cpu->dev.offline_disabled = !cpu->hotpluggable;
291292
cpu->dev.offline = !cpu_online(num);
293+
cpu->dev.of_node = of_get_cpu_node(num, NULL);
292294
#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
293295
cpu->dev.bus->uevent = arch_cpu_uevent;
294296
#endif

0 commit comments

Comments
 (0)