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

Jonathan Cameron Jonathan.Cameron at huawei.com
Tue Jul 8 01:38:51 PDT 2025


On Mon, 7 Jul 2025 16:04:14 +0100
Alireza Sanaee <alireza.sanaee at huawei.com> wrote:

> Update arm-dsu to use the new API, where both "cpus" and "cpu"
> properties are supported.
> 
> Signed-off-by: Alireza Sanaee <alireza.sanaee at huawei.com>
> ---
>  drivers/perf/arm_dsu_pmu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
> index cb4fb59fe04b..7ef204d39173 100644
> --- a/drivers/perf/arm_dsu_pmu.c
> +++ b/drivers/perf/arm_dsu_pmu.c
> @@ -596,11 +596,9 @@ static int dsu_pmu_dt_get_cpus(struct device *dev, cpumask_t *mask)
>  	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);
> +		cpu = of_cpu_phandle_to_id(dev->of_node, &cpu_node, i);
Same again. 
Does any code actually use the cpu_node?

If not you need a strong justification for ever letting it out of the new
helper.
>  		of_node_put(cpu_node);
>  		/*
>  		 * We have to ignore the failures here and continue scanning




More information about the linux-arm-kernel mailing list