[PATCH 4/5] coresight: Use of_cpu_phandle_to_id for grabbing CPU id

Jonathan Cameron Jonathan.Cameron at huawei.com
Tue Jul 8 01:37:11 PDT 2025


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

> Use the newly created API to grab CPU id.
> 
> Signed-off-by: Alireza Sanaee <alireza.sanaee at huawei.com>
> ---
>  drivers/hwtracing/coresight/coresight-platform.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index 8192ba3279f0..f032fdbe959b 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -167,19 +167,9 @@ of_coresight_get_output_ports_node(const struct device_node *node)
>  
>  static int of_coresight_get_cpu(struct device *dev)
>  {
> -	int cpu;
> -	struct device_node *dn;
> -
> -	if (!dev->of_node)
> -		return -ENODEV;
> -
> -	dn = of_parse_phandle(dev->of_node, "cpu", 0);
> -	if (!dn)
> -		return -ENODEV;
> -
> -	cpu = of_cpu_node_to_id(dn);
> +	struct device_node *dn = NULL;
> +	int cpu = of_cpu_phandle_to_id(dev->of_node, &dn, 0);
>  	of_node_put(dn);
> -
	Again, allowing for NULL parameter gives you simply

	return of_cpu_phandle_to_id(dev->of_node, NULL, 0);

>  	return cpu;
>  }
>  




More information about the linux-arm-kernel mailing list