Use the newly created API to grab CPU id.
Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
---
.../hwtracing/coresight/coresight-cti-platform.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
index d0ae10bf6128..e1dc559d54aa 100644
--- a/drivers/hwtracing/coresight/coresight-cti-platform.c
+++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
@@ -41,20 +41,8 @@
*/
static int of_cti_get_cpu_at_node(const struct device_node *node)
{
- int cpu;
- struct device_node *dn;
+ int cpu = of_cpu_phandle_to_id(node, NULL, 0);
- 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);
- of_node_put(dn);
-
- /* No Affinity if no cpu nodes are found */
return (cpu < 0) ? -1 : cpu;
}
--
2.43.0
Hi,
On Tue, 8 Jul 2025 at 16:16, Alireza Sanaee <alireza.sanaee@huawei.com> wrote:
>
> Use the newly created API to grab CPU id.
>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> ---
> .../hwtracing/coresight/coresight-cti-platform.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index d0ae10bf6128..e1dc559d54aa 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -41,20 +41,8 @@
> */
> static int of_cti_get_cpu_at_node(const struct device_node *node)
> {
> - int cpu;
> - struct device_node *dn;
> + int cpu = of_cpu_phandle_to_id(node, NULL, 0);
>
> - 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);
> - of_node_put(dn);
> -
> - /* No Affinity if no cpu nodes are found */
Leave the above comment in place.
> return (cpu < 0) ? -1 : cpu;
> }
>
> --
> 2.43.0
>
With that
Reviewed-by: Mike Leach <mike.leach@linro.org>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
On Fri, 11 Jul 2025 16:55:15 +0100
Mike Leach <mike.leach@linaro.org> wrote:
> Hi,
>
> On Tue, 8 Jul 2025 at 16:16, Alireza Sanaee <alireza.sanaee@huawei.com> wrote:
> >
> > Use the newly created API to grab CPU id.
> >
> > Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> > ---
> > .../hwtracing/coresight/coresight-cti-platform.c | 14 +-------------
> > 1 file changed, 1 insertion(+), 13 deletions(-)
> >
> > diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> > index d0ae10bf6128..e1dc559d54aa 100644
> > --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> > +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> > @@ -41,20 +41,8 @@
> > */
> > static int of_cti_get_cpu_at_node(const struct device_node *node)
> > {
> > - int cpu;
> > - struct device_node *dn;
> > + int cpu = of_cpu_phandle_to_id(node, NULL, 0);
> >
> > - 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);
> > - of_node_put(dn);
> > -
> > - /* No Affinity if no cpu nodes are found */
>
> Leave the above comment in place.
>
> > return (cpu < 0) ? -1 : cpu;
> > }
> >
> > --
> > 2.43.0
> >
>
> With that
>
> Reviewed-by: Mike Leach <mike.leach@linro.org>
Just in case Ali doesn't notice - typo in your address Mike!
(usually it is me who manages that ;)
On Tue, 8 Jul 2025 16:15:00 +0100
Alireza Sanaee <alireza.sanaee@huawei.com> wrote:
> Use the newly created API to grab CPU id.
>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> ---
> .../hwtracing/coresight/coresight-cti-platform.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c
> index d0ae10bf6128..e1dc559d54aa 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
> @@ -41,20 +41,8 @@
> */
> static int of_cti_get_cpu_at_node(const struct device_node *node)
> {
> - int cpu;
> - struct device_node *dn;
> + int cpu = of_cpu_phandle_to_id(node, NULL, 0);
Could do a single line - kind of down to coresight maintainers preference though!
return (of_cpu_phandle_to_id(node, NULL, 0) < 0) ? -1; cpu;
+CC Suzuki (you got the two reviewers in the +CC but not the maintainer)
>
> - 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);
> - of_node_put(dn);
> -
> - /* No Affinity if no cpu nodes are found */
> return (cpu < 0) ? -1 : cpu;
> }
>
© 2016 - 2026 Red Hat, Inc.