This series refactors the way CPU IDs are retrieved from the device tree.
Usually, there is a for loop that goes over every single CPU that can be avoided. This also reduces the amount of NULL pointer checks in drivers. I have abstracted away that loop and introduced a new function (of_cpu_node_to_id) for this.
This patchset is a subset of [1], where I removed content and patches relevant to hyper-threaded cores for DT. Based on the discussion, the code refactor is still useful, hence this patchset.
[1] https://lore.kernel.org/all/20250512080715.82-1-alireza.sanaee@huawei.com/
Alireza Sanaee (5): of: add infra for finding CPU id from phandle arch_topology: update CPU map to use the new API coresight: cti: Use of_cpu_phandle_to_id for grabbing CPU id coresight: Use of_cpu_phandle_to_id for grabbing CPU id perf/arm-dsu: refactor cpu id retrieval via new API of_cpu_phandle_to_id
drivers/base/arch_topology.c | 12 ++++---- .../coresight/coresight-cti-platform.c | 15 ++-------- .../hwtracing/coresight/coresight-platform.c | 14 ++------- drivers/of/cpu.c | 29 +++++++++++++++++++ drivers/perf/arm_dsu_pmu.c | 6 ++-- include/linux/of.h | 9 ++++++ 6 files changed, 51 insertions(+), 34 deletions(-)