[PATCH v4 6/6] perf/arm-dsu: refactor cpu id retrieval via new API of_cpu_phandle_to_id

Alireza Sanaee posted 6 patches 5 months, 1 week ago
[PATCH v4 6/6] perf/arm-dsu: refactor cpu id retrieval via new API of_cpu_phandle_to_id
Posted by Alireza Sanaee 5 months, 1 week ago
Update arm-dsu to use the new API (of_cpu_phandle_to_id).

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
---
 drivers/perf/arm_dsu_pmu.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
index cb4fb59fe04b..8f76bd94349c 100644
--- a/drivers/perf/arm_dsu_pmu.c
+++ b/drivers/perf/arm_dsu_pmu.c
@@ -591,17 +591,12 @@ static struct dsu_pmu *dsu_pmu_alloc(struct platform_device *pdev)
 static int dsu_pmu_dt_get_cpus(struct device *dev, cpumask_t *mask)
 {
 	int i = 0, n, cpu;
-	struct device_node *cpu_node;
 
 	n = of_count_phandle_with_args(dev->of_node, "cpus", NULL);
 	if (n <= 0)
 		return -ENODEV;
 	for (; i < n; i++) {
-		cpu_node = of_parse_phandle(dev->of_node, "cpus", i);
-		if (!cpu_node)
-			break;
-		cpu = of_cpu_node_to_id(cpu_node);
-		of_node_put(cpu_node);
+		cpu = of_cpu_phandle_to_id(dev->of_node, NULL, i);
 		/*
 		 * We have to ignore the failures here and continue scanning
 		 * the list to handle cases where the nr_cpus could be capped
-- 
2.43.0
Re: [PATCH v4 6/6] perf/arm-dsu: refactor cpu id retrieval via new API of_cpu_phandle_to_id
Posted by Suzuki K Poulose 5 months ago
On 05/09/2025 17:18, Alireza Sanaee wrote:
> Update arm-dsu to use the new API (of_cpu_phandle_to_id).
> 
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> ---
>   drivers/perf/arm_dsu_pmu.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
> index cb4fb59fe04b..8f76bd94349c 100644
> --- a/drivers/perf/arm_dsu_pmu.c
> +++ b/drivers/perf/arm_dsu_pmu.c
> @@ -591,17 +591,12 @@ static struct dsu_pmu *dsu_pmu_alloc(struct platform_device *pdev)
>   static int dsu_pmu_dt_get_cpus(struct device *dev, cpumask_t *mask)
>   {
>   	int i = 0, n, cpu;
> -	struct device_node *cpu_node;
>   
>   	n = of_count_phandle_with_args(dev->of_node, "cpus", NULL);
>   	if (n <= 0)
>   		return -ENODEV;
>   	for (; i < n; i++) {
> -		cpu_node = of_parse_phandle(dev->of_node, "cpus", i);
> -		if (!cpu_node)
> -			break;
> -		cpu = of_cpu_node_to_id(cpu_node);
> -		of_node_put(cpu_node);
> +		cpu = of_cpu_phandle_to_id(dev->of_node, NULL, i);
>   		/*
>   		 * We have to ignore the failures here and continue scanning
>   		 * the list to handle cases where the nr_cpus could be capped

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>