diff options
author | Gavin Shan <gshan@redhat.com> | 2020-03-19 00:01:44 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2020-03-24 18:24:19 +0100 |
commit | de58ed5e16e62f36c7ed05552f18b7f9c647dcaf (patch) | |
tree | b92e5b00897604c1e1efd375cc1a27d51c2c3aa3 /arch/arm64/kernel/cpuidle.c | |
parent | arm64: Rename cpu_read_ops() to init_cpu_ops() (diff) | |
download | linux-de58ed5e16e62f36c7ed05552f18b7f9c647dcaf.tar.xz linux-de58ed5e16e62f36c7ed05552f18b7f9c647dcaf.zip |
arm64: Introduce get_cpu_ops() helper function
This introduces get_cpu_ops() to return the CPU operations according to
the given CPU index. For now, it simply returns the @cpu_ops[cpu] as
before. Also, helper function __cpu_try_die() is introduced to be shared
by cpu_die() and ipi_cpu_crash_stop(). So it shouldn't introduce any
functional changes.
Signed-off-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Diffstat (limited to 'arch/arm64/kernel/cpuidle.c')
-rw-r--r-- | arch/arm64/kernel/cpuidle.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c index e4d6af2fdec7..b512b5503f6e 100644 --- a/arch/arm64/kernel/cpuidle.c +++ b/arch/arm64/kernel/cpuidle.c @@ -18,11 +18,11 @@ int arm_cpuidle_init(unsigned int cpu) { + const struct cpu_operations *ops = get_cpu_ops(cpu); int ret = -EOPNOTSUPP; - if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_suspend && - cpu_ops[cpu]->cpu_init_idle) - ret = cpu_ops[cpu]->cpu_init_idle(cpu); + if (ops && ops->cpu_suspend && ops->cpu_init_idle) + ret = ops->cpu_init_idle(cpu); return ret; } @@ -37,8 +37,9 @@ int arm_cpuidle_init(unsigned int cpu) int arm_cpuidle_suspend(int index) { int cpu = smp_processor_id(); + const struct cpu_operations *ops = get_cpu_ops(cpu); - return cpu_ops[cpu]->cpu_suspend(index); + return ops->cpu_suspend(index); } #ifdef CONFIG_ACPI |