int of_coresight_get_cpu(const struct device_node *node) { int cpu; struct device_node *dn; dn = of_parse_phandle(node, "cpu", 0); /* Affinity defaults to CPU0 */ if (!dn) return 0; cpu = of_cpu_node_to_id(dn); of_node_put(dn); /* Affinity to CPU0 if no cpu nodes are found */ return (cpu < 0) ? 0 : cpu; }
static int __init get_cpu_for_node(struct device_node *node) { struct device_node *cpu_node; int cpu; cpu_node = of_parse_phandle(node, "cpu", 0); if (!cpu_node) return -1; cpu = of_cpu_node_to_id(cpu_node); if (cpu >= 0) topology_parse_cpu_capacity(cpu_node, cpu); else pr_crit("Unable to find CPU node for %pOF\n", cpu_node); of_node_put(cpu_node); return cpu; }