[PATCH v3 4/6] coresight: cti: Use of_cpu_phandle_to_id for grabbing CPU id

Alireza Sanaee
2025-07-18T10:07:09Z

Use the newly created API (of_cpu_phandle_to_id) to grab CPU ID.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
---
.../hwtracing/coresight/coresight-cti-platform.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
index d0ae10bf6128..2629962dbe3e 100644
--- a/drivers/hwtracing/coresight/coresight-cti-platform.c
+++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
@@ -41,18 +41,7 @@
*/
static int of_cti_get_cpu_at_node(const struct device_node *node)
{
- int cpu;
- struct device_node *dn;
-
- if (node == NULL)
- return -1;
-
- dn = of_parse_phandle(node, "cpu", 0);
- /* CTI affinity defaults to no cpu */
- if (!dn)
- return -1;
- cpu = of_cpu_node_to_id(dn);
- of_node_put(dn);
+ int cpu = of_cpu_phandle_to_id(node, NULL, 0);

/* No Affinity if no cpu nodes are found */
return (cpu < 0) ? -1 : cpu;
--
2.43.0