riscv: use for_each_of_cpu_node iterator

Use the new for_each_of_cpu_node() helper to iterate over cpu nodes
instead of open coding. Note that this will allow matching also on the
node name instead of the (for FDT) deprecated device_type property.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
Johan Hovold
2019-01-18 15:03:08 +01:00
committed by Palmer Dabbelt
parent e3d794d555
commit dd81c8ab81
2 changed files with 5 additions and 4 deletions

View File

@@ -50,12 +50,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
void __init setup_smp(void)
{
struct device_node *dn = NULL;
struct device_node *dn;
int hart;
bool found_boot_cpu = false;
int cpuid = 1;
while ((dn = of_find_node_by_type(dn, "cpu"))) {
for_each_of_cpu_node(dn) {
hart = riscv_of_processor_hartid(dn);
if (hart < 0)
continue;