[PATCH v4 5/6] coresight: Use of_cpu_phandle_to_id for grabbing CPU ID

Alireza Sanaee posted 6 patches 5 months ago
[PATCH v4 5/6] coresight: Use of_cpu_phandle_to_id for grabbing CPU ID
Posted by Alireza Sanaee 5 months ago
Use the newly created API (of_cpu_phandle_to_id) to grab CPU ID.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
---
 drivers/hwtracing/coresight/coresight-platform.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 0db64c5f4995..95d46ea08936 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -167,20 +167,7 @@ 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);
-	of_node_put(dn);
-
-	return cpu;
+	return of_cpu_phandle_to_id(dev->of_node, NULL, 0);
 }
 
 /*
-- 
2.43.0
Re: [PATCH v4 5/6] coresight: Use of_cpu_phandle_to_id for grabbing CPU ID
Posted by Suzuki K Poulose 4 months, 4 weeks ago
On 05/09/2025 17:18, Alireza Sanaee wrote:
> Use the newly created API (of_cpu_phandle_to_id) to grab CPU ID.
> 
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Reviewed-by: Mike Leach <mike.leach@linaro.org>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> ---
>   drivers/hwtracing/coresight/coresight-platform.c | 15 +--------------
>   1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index 0db64c5f4995..95d46ea08936 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -167,20 +167,7 @@ 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);
> -	of_node_put(dn);
> -
> -	return cpu;
> +	return of_cpu_phandle_to_id(dev->of_node, NULL, 0);
>   }
>   
>   /*

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