diff options
author | Ashwin Chaugule <ashwin.chaugule@linaro.org> | 2014-03-13 00:21:19 -0400 |
---|---|---|
committer | Graeme Gregory <graeme.gregory@linaro.org> | 2014-06-03 09:24:27 +0100 |
commit | 2280f1534dd681f111752bc1288859a0248055a2 (patch) | |
tree | b33578c858fef7292a1b267ce3214c226d7e7f2c | |
parent | c78e42dc1379e9abf4323ab2270ef75cc40a68b8 (diff) | |
download | leg-kernel-2280f1534dd681f111752bc1288859a0248055a2.tar.gz |
arm64: Simplify cpu_ops for DT and ACPI
Except for getting the enable_method, the rest
of the operations are similar for DT and ACPI and
thus can be unified.
Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
Acked-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
-rw-r--r-- | arch/arm64/include/asm/cpu_ops.h | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/cpu_ops.c | 57 | ||||
-rw-r--r-- | arch/arm64/kernel/smp.c | 4 |
3 files changed, 18 insertions, 45 deletions
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h index 14e5fc71f25e..152413076503 100644 --- a/arch/arm64/include/asm/cpu_ops.h +++ b/arch/arm64/include/asm/cpu_ops.h @@ -59,7 +59,7 @@ struct cpu_operations { }; extern const struct cpu_operations *cpu_ops[NR_CPUS]; -extern int __init cpu_of_read_ops(struct device_node *dn, int cpu); +extern int __init cpu_read_ops(struct device_node *dn, int cpu); extern void __init cpu_read_bootcpu_ops(void); #endif /* ifndef __ASM_CPU_OPS_H */ diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c index c93ae18c4fa2..4d96ec3e166a 100644 --- a/arch/arm64/kernel/cpu_ops.c +++ b/arch/arm64/kernel/cpu_ops.c @@ -45,37 +45,9 @@ static const struct cpu_operations * __init cpu_get_ops(const char *name) ops++; } - return NULL; } -/* - * Read a cpu's enable method from the device tree and record it in cpu_ops. - */ -int __init cpu_of_read_ops(struct device_node *dn, int cpu) -{ - const char *enable_method = of_get_property(dn, "enable-method", NULL); - if (!enable_method) { - /* - * The boot CPU may not have an enable method (e.g. when - * spin-table is used for secondaries). Don't warn spuriously. - */ - if (cpu != 0) - pr_err("%s: missing enable-method property\n", - dn->full_name); - return -ENOENT; - } - - cpu_ops[cpu] = cpu_get_ops(enable_method); - if (!cpu_ops[cpu]) { - pr_warn("%s: unsupported enable-method property: %s\n", - dn->full_name, enable_method); - return -EOPNOTSUPP; - } - - return 0; -} - #ifdef CONFIG_ACPI /* * This is place holder for code which investigates bootup method for @@ -88,13 +60,22 @@ static const char *cpu_acpi_get_enable_method(int cpu) { return "psci"; } +#else +static const char *cpu_acpi_get_enable_method(int cpu) +{ + return NULL; +} +#endif -/* - * Read a cpu's enable method in the ACPI way and record it in cpu_ops. - */ -int __init cpu_acpi_read_ops(int cpu) +int __init cpu_read_ops(struct device_node *dn, int cpu) { - const char *enable_method = cpu_acpi_get_enable_method(cpu); + const char *enable_method = NULL; + /* If you get a valid dn, then we're using OF, else ACPI. */ + if (dn) + enable_method = of_get_property(dn, "enable-method", NULL); + else + enable_method = cpu_acpi_get_enable_method(cpu); + if (!enable_method) { /* * The boot CPU may not have an enable method (e.g. when @@ -111,19 +92,11 @@ int __init cpu_acpi_read_ops(int cpu) cpu, enable_method); return -EOPNOTSUPP; } - return 0; } -#endif - void __init cpu_read_bootcpu_ops(void) { struct device_node *dn = of_get_cpu_node(0, NULL); - if (dn) { - cpu_of_read_ops(dn, 0); - return; - } - - cpu_acpi_read_ops(0); + cpu_read_ops(dn, 0); } diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 5adbcb5ae26f..cee94b769e40 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -359,7 +359,7 @@ static int __init of_smp_init_cpus(void) if (cpu >= NR_CPUS) goto next; - if (cpu_of_read_ops(dn, cpu) != 0) + if (cpu_read_ops(dn, cpu) != 0) goto next; if (cpu_ops[cpu]->cpu_init(dn, cpu)) @@ -483,7 +483,7 @@ acpi_smp_parse_madt(struct acpi_subtable_header *header, const unsigned long end if (cpu >= NR_CPUS) continue; - if (cpu_acpi_read_ops(cpu) != 0) + if (cpu_read_ops(NULL, cpu) != 0) continue; if (cpu_ops[cpu]->cpu_init(NULL, cpu)) |