[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708093623.0000363e@huawei.com>
Date: Tue, 8 Jul 2025 09:36:23 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Alireza Sanaee <alireza.sanaee@...wei.com>
CC: <mark.rutland@....com>, <robh@...nel.org>, <coresight@...ts.linaro.org>,
<devicetree@...r.kernel.org>, <dianders@...omium.org>,
<james.clark@...aro.org>, <krzk@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<linux-perf-users@...r.kernel.org>, <linuxarm@...wei.com>,
<mike.leach@...aro.org>, <ruanjinjie@...wei.com>, <saravanak@...gle.com>,
<shameerali.kolothum.thodi@...wei.com>, <suzuki.poulose@....com>
Subject: Re: [PATCH 3/5] coresight: cti: Use of_cpu_phandle_to_id for
grabbing CPU id
On Mon, 7 Jul 2025 16:04:12 +0100
Alireza Sanaee <alireza.sanaee@...wei.com> wrote:
> Use the newly created API to grab CPU id.
>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@...wei.com>
Here is the justification for allowing the node parameter to be null.
> ---
> .../hwtracing/coresight/coresight-cti-platform.c | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index d0ae10bf6128..cd821e926792 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -41,21 +41,12 @@
> */
> static int of_cti_get_cpu_at_node(const struct device_node *node)
> {
> + struct device_node *dn = NULL;
> 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);
> + cpu = of_cpu_phandle_to_id(node, &dn, 0);
> of_node_put(dn);
With change suggested on patch 1 this becomes
static int of_cti_get_cpu_at_node(const struct device_node *node)
{
int cpu = of_cpu_phandle_to_id(node, NULL, 0);
return (cpu < 0) ? -1 : cpu;
}
> -
> - /* No Affinity if no cpu nodes are found */
> - return (cpu < 0) ? -1 : cpu;
> + return cpu;
This an result in -ENODEV hence juggle above. No idea
why the caller will care but I guess it does or this code
would not be here!
> }
>
> #else
Powered by blists - more mailing lists