Merge branch 'for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
[sfrench/cifs-2.6.git] / drivers / hwtracing / coresight / of_coresight.c
index a18794128bf864bb0be7d5d6a062c8bfc38884ad..7c375443ede65198c158794861c10cff9295a15b 100644 (file)
@@ -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);