diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2018-01-02 12:25:28 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2018-01-02 17:43:12 +0100 |
commit | 29198e3844caaaacb0e21eff634c5f1cfd7f89be (patch) | |
tree | ffc6e043e8bdabddbf3dee0e4280e87d81a2769c /drivers/hwtracing | |
parent | of: Add helper for mapping device node to logical CPU number (diff) | |
download | linux-29198e3844caaaacb0e21eff634c5f1cfd7f89be.tar.xz linux-29198e3844caaaacb0e21eff634c5f1cfd7f89be.zip |
coresight: of: Use of_cpu_node_to_id helper
Reuse the new generic helper, of_cpu_node_to_id() to map a
given CPU phandle to a logical CPU number.
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r-- | drivers/hwtracing/coresight/of_coresight.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index a18794128bf8..7c375443ede6 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -104,26 +104,17 @@ static int of_coresight_alloc_memory(struct device *dev, int of_coresight_get_cpu(const struct device_node *node) { int cpu; - bool found; - struct device_node *dn, *np; + struct device_node *dn; dn = of_parse_phandle(node, "cpu", 0); - /* Affinity defaults to CPU0 */ if (!dn) return 0; - - for_each_possible_cpu(cpu) { - np = of_cpu_device_node_get(cpu); - found = (dn == np); - of_node_put(np); - if (found) - break; - } + cpu = of_cpu_node_to_id(dn); of_node_put(dn); /* Affinity to CPU0 if no cpu nodes are found */ - return found ? cpu : 0; + return (cpu < 0) ? 0 : cpu; } EXPORT_SYMBOL_GPL(of_coresight_get_cpu); |