Re: [PATCH v3 1/6] of: add infra for finding CPU id from phandle

Rob Herring (Arm)
2025-07-21T00:32:48Z

On Fri, 18 Jul 2025 10:48:43 +0100, Alireza Sanaee wrote:
> Get CPU ID from phandle. Some drivers such as coresight, cti-coresight,
> or arm-dsu use this API for finding CPU node in DT. In particular,
> drivers do this by getting the CPU device_node through a phandle and
> then find the CPU ID using of_cpu_node_to_id(). This commit encapsulates
> CPU node finding and improves readability.
>
> The API interface takes three parameters, 1) node, 2) pointer to
> pointer of CPU node, 3) CPU node index. API sets the pointer to the CPU
> node and allows the driver to work with the CPU node, for logging
> purposes for instance.
>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> ---
> drivers/of/cpu.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/of.h | 9 +++++++++
> 2 files changed, 58 insertions(+)
>

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>